Vue3报错:Extraneous non-props attributes (style) were passed to component but could not be automatical
Vue3报错:Extraneous non-props attributes (style) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
文章共235字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
Vue3报错:Extraneous non-props attributes (style) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
翻译是:无关的非道具属性(样式)被传递给组件,但由于组件呈现片段或文本根节点而无法自动继承。
出现这个错误的原因是在组件的节点上添加了样式,也就是
<组件 style='display:none'></组件>
我本来的思路是想让这个组件隐藏起来的,但这样行不通
所以解决办法就是在组件外套一层div,即
<div style='display:none'>
<组件></组件>
</div>
更多推荐
已为社区贡献6条内容
所有评论(0)