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 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.


翻译是:无关的非道具属性(样式)被传递给组件,但由于组件呈现片段或文本根节点而无法自动继承。


出现这个错误的原因是在组件的节点上添加了样式,也就是

<组件 style='display:none'></组件>

我本来的思路是想让这个组件隐藏起来的,但这样行不通


所以解决办法就是在组件外套一层div,即

<div style='display:none'>
  <组件></组件>
</div>
相关文章
|
4天前
|
JavaScript 网络架构
vue3 Elementplus 动态路由菜单不跳转问题
vue3 Elementplus 动态路由菜单不跳转问题
17 1
|
4天前
|
JavaScript 前端开发 API
vue3和vue2的区别
vue3和vue2的区别
|
4天前
|
JavaScript API 开发者
vue3 的生命周期
vue3 的生命周期
|
5天前
Vue3项目 小兔鲜问题总结
Vue3项目 小兔鲜问题总结
16 2
|
5天前
vue3基本指令使用
vue3基本指令使用
11 2
Vue3组件,注册全局组件和局部组件
Vue3组件,注册全局组件和局部组件
|
3天前
技术笔记:Vue3之emits
技术笔记:Vue3之emits
|
2月前
|
JavaScript API
【vue实战项目】通用管理系统:api封装、404页
【vue实战项目】通用管理系统:api封装、404页
48 3
|
2月前
|
人工智能 JavaScript 前端开发
毕设项目-基于Springboot和Vue实现蛋糕商城系统(三)
毕设项目-基于Springboot和Vue实现蛋糕商城系统
|
2月前
|
JavaScript Java 关系型数据库
毕设项目-基于Springboot和Vue实现蛋糕商城系统(一)
毕设项目-基于Springboot和Vue实现蛋糕商城系统
111 0