vue 父组件动态传值给子组件的方法

父组件:

<uni-collapse-item title="标题信息" ref="child1" thumb="../../static/send-goods.png"></uni-collapse-item>

this.$refs.child1.childMethod(count)  //调用子组件的函数,并把这个状态传过去。
如果在v-for循环中:
that.$refs.child[index].childMethod(count)

  

子组件: 

 data () {
    return {
       childVal:''
    }
  },   
methods: {
   childMethod(flag) {  //这个就是子组件的函数 参数是父组件调用时传过来的
     this.childVal = flag;   //将这个状态赋给当前的对话框所绑定data数据上
  }
}

  

原文地址:https://www.cnblogs.com/lemonmoney/p/11777464.html