报错:
Extraneous non-props attributes (id) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
原因:
父组件传递了props参数,子组件没有接收,并且子组件不止一个根节点。
解决:
方法一:
在子组件中使用 defineProps
接收参数。
方法二:
子组件中存在多个根节点,在对应的根节点使用v-bind=”$attrs"进行显式绑定。
方法三:
将子组件包裹在一个根节点下。