這裡的child-say 是指定的不能更改
父組件
<component-a v-on:child-say="listenToMyBoy"></component-a>
<p>Do you like me? {{childWords}}</p>
methods: {
listenToMyBoy: function (somedata){
this.childWords = somedata
}
}
子組件
<button v-on:click="onClickMe">like!</button> methods: { onClickMe: function(){ this.$emit('child-say',this.somedata); } }
更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!