vue 父子组件

父组件拿子组件值,调用子组建方法。

父组件:<child ref="lueluelue"></child>

             <el-button @click="onclick">dianji</el-button>

              onclick(){

         let child = this.$refs.lueluelue

           console.log(child.zhi)//值

           consoloe.log(child.fangfa())//方法 

     }

子组件取父组件的值,调用父组件方法。

 子组件:this.$parent.fuzujianfangfa() //调用父组件方法

传值-父组件: this.$parent.title

原文地址:https://www.cnblogs.com/youngMan-MrS/p/12660255.html