Loading

uniapp 子组件给父组件传值

子组件:

<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
}
},

 

posted @ 2021-11-01 23:44  mingBolg  阅读(1259)  评论(0编辑  收藏  举报