. -子组件间通信

let children={
    template:`<div><h1>{{send}}</h1></div>`,  # 将传过来的信息send渲染出来
    props:['send']  # 通过props来获取父级传过来的信息
};

let parent={
    components:{xx:children},
    template:'<xx v-bind:send="num"></xx>', # 自定义个绑定属相send,data
    data(){return {num:6688}}  # 获取num,传给send属相
};

new Vue({
    el:'#app',
    components:{parent},
    template:'<parent></parent>'
})

相关文章:

  • 2021-05-08
  • 2021-10-07
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-24
  • 2021-11-15
  • 2022-01-29
  • 2022-12-23
  • 2021-11-08
  • 2022-01-21
  • 2022-02-11
相关资源
相似解决方案