1.子组件绑定事件
<button @click='addcity'>添加一个城市</button>
2.传递
addcity(){
this.$emit('addappcity', '商丘');
}
3.父组件绑定事件接受
<Vcontent v-on:addappcity='addhander'></Vcontent>
4.添加事件
addhander(str){
this.city.push(str);
}
1.子组件绑定事件
<button @click='addcity'>添加一个城市</button>
2.传递
addcity(){
this.$emit('addappcity', '商丘');
}
3.父组件绑定事件接受
<Vcontent v-on:addappcity='addhander'></Vcontent>
4.添加事件
addhander(str){
this.city.push(str);
}