vue爷孙组件传参v-bind=“$attrs“ v-on=“$listeners“

孙title this.$emit(‘事件名’,要传递的值)

// title
  methods: {
   
        change(e) {
   
            console.log(e, 'e');
            this.$emit("sValue", this.sValue, this.options[0].label)
        }
    }

父 box v-bind=“ a t t r s " v − o n = " attrs" v-on=" attrs"von="listeners”

<div class="box-wrap">
        <Title v-bind="$attrs" v-on="$listeners"></Title>
        <div class="box">
            <slot></slot>
        </div>
    </div>

爷 index

<Box @sValue="sValue">
  </Box>
   sValue(e, e1) {
   
            console.log(e, e1, 'eee');
          }

相关推荐

  1. vue组件v-bind=“$attrs“ v-on=“$listeners“

    2023-12-21 07:50:03       50 阅读
  2. Vue组件

    2023-12-21 07:50:03       53 阅读
  3. vue3组件

    2023-12-21 07:50:03       38 阅读
  4. VUE父子组件问题

    2023-12-21 07:50:03       44 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-21 07:50:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-21 07:50:03       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-21 07:50:03       82 阅读
  4. Python语言-面向对象

    2023-12-21 07:50:03       91 阅读

热门阅读

  1. Linux|shell编程|实验总结|期末考查试题

    2023-12-21 07:50:03       39 阅读
  2. Wireshark在移动网络中的应用

    2023-12-21 07:50:03       44 阅读
  3. Spark发送到Kafka的数据出现重复问题解决方案

    2023-12-21 07:50:03       60 阅读
  4. xrandr

    2023-12-21 07:50:03       66 阅读
  5. 实用高阶函数map,reduce,filter

    2023-12-21 07:50:03       47 阅读
  6. 飞天使-k8s知识点3-卸载yum 安装的k8s

    2023-12-21 07:50:03       55 阅读
  7. SQL面试题挑战03:奖金瓜分问题(拼多多)

    2023-12-21 07:50:03       57 阅读
  8. GBDT-梯度提升决策树

    2023-12-21 07:50:03       41 阅读
  9. 前端:NPM的介绍和使用

    2023-12-21 07:50:03       58 阅读