[Vue warn]: Extraneous non-props attributes (class)

// 最外层多个标签,无法在使用子组件标签上定义 class

// 会报错:[Vue warn]: Extraneous non-props attributes (class)

// were passed to component but could not be automatically inherited

// because component renders fragment or text root nodes.

// at <Demo3 class="green" > at <App>

// 下面把这个问题解决了:绑定父标签的属性值

app.component('demo3', {

template: `

<div :class="$attrs.class">zibo31</div>

<div :class="$attrs.class">zibo32</div>

`

});

相关推荐
漂移的电子7 分钟前
【el-tree】外层多选,某个属性内层单选
前端·javascript·vue.js
BJ-Giser18 分钟前
Cesium 体积光阴影率分析和阴影体渲染效果
前端·可视化·cesium
幽络源小助理22 分钟前
YK一点资讯Zblog主题源码, 游戏攻略新闻资讯模板
前端·php源码
RPGMZ24 分钟前
RPGMZ NPC头顶自动显示一段消息
前端·游戏引擎·rpgmz·rpgmakermz
DFT计算杂谈30 分钟前
AMSET 设置多核并行计算
java·前端·css·html·css3
花椒技术34 分钟前
AI 协同开发落地复盘:1 小时生成首版后,为什么 Review 和修正又花了 2-3 天
前端·人工智能·架构
万少1 小时前
万少用9个AI工具,帮朋友完成了一个"不可能"的项目
前端
小小小小宇1 小时前
Vue `import` 为什么可以异步加载
前端
WMYeah1 小时前
【无标题】
前端·rust·抽奖程序·跨平台抽奖程序
Unbelievabletobe1 小时前
免费外汇api的响应时间在不同时段下的波动分析
大数据·开发语言·前端·python