子组件:

<view class="" @click="zi">子组件给父传</view>

methods:{
zi(){
this.$emit('myZi',this.age)
}
}

 

父组件:

<test122 @myZi='getZi'></test122>
<view class="">{{age}}</view>

data() {
return {
num:1,
title:'我是你明哥哥',
catename:['红豆','花生','小米'],
age:20
}
},
methods: {
getZi(age){
this.age = age
}
},

 

相关文章:

  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2021-09-15
  • 2022-12-23
  • 2021-11-12
相关资源
相似解决方案