子组件中:
this.showFaceDia = false
this.$emit('showFaceDia',this.showFaceDia) //执行showFaceDia函数并把要改变的值作为参数带过去
父组件:
methods:{
showFaceDia(msg){
this.showFaceDia = msg
}
}
不要忘记在DOM中引用:
<test :title="title" @showFaceDia="showFaceDia"></test>//注意showFaceDia后不能加括号