当前位置: 首页 > article >正文

[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>
    `
  });


http://www.kler.cn/news/137160.html

相关文章:

  • 架构师备考-背诵精华(系统架构评估)
  • 监控易监测对象及指标之:JBoss 7.1.x中间件监控
  • ElasticSearch的向量存储和搜索
  • 使用SpringBoot自定义注解+AOP+redisson锁来实现防接口幂等性重复提交
  • 【C++、数据结构】二叉排序树(二叉查找树、二叉搜索树)(图解+完整代码)
  • 手机功耗技术点
  • linux进程间通信之消息队列
  • 操作系统基础操作
  • Gem5系统仿真模拟器之创建gem5——翻译自官网
  • MYSQL进阶——存储引擎
  • 【Python入门教程】OpenCV在图片/视频上添加Logo(水印)
  • 云ES容灾方案
  • “茶叶创新:爆改营销策略,三个月狂销2300万“
  • 酒店品牌纷纷冲击中高端,东呈集团能否“快人一步”?
  • “一键导出,高效整理:将之前的部分记录导出!“
  • 如何保障亚马逊多账户的安全,防止关联?
  • 福州大学《嵌入式系统综合设计》实验四:边缘检测
  • Leetcode84(柱状图中最大的矩形)
  • 设计模式-12-策略模式
  • 最新最全系列之Selenium:传入webdriver驱动的新方法 Service()函数;以前的executable_path报警告,即将弃用
  • C/C++杂谈-printf的可变参数机制
  • C# 电脑程序控制电路开关
  • 局域网内Ubuntu上搭建Git服务器
  • 通过css设置元素隐藏和显示
  • UEC++ day6
  • C#使用MaxMind.GeoIP2数据库查询当前ip地址