vue3组件调用解决奇怪问题的详细记录
左边是父组件,右边是子组件,运行正常:
父组件中的子组件加上class属性,运行报错:Extraneous non-props attributes (class) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
父组件中的子组件加上id属性,运行报错:Extraneous non-props attributes (id) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
解决方法1:
父组件中的子组件加上id属性,子组件删除了<template>下面的注释行,运行正常:
解决方法2:
父组件中的子组件加上id属性,子组件删除class属性,确保剩下的class属性不超过4个,运行正常: