vue组件传值
组件中定义事件
getServiceActive(index,text) {
this.active_type = index;
if(text=="全部")
{
text=null;
}
this.type_text=text;
this.$emit("ListenChildEvent",{"type_text":this.type_text,"state_text":this.state_text});
},
页面中引用组件
<ServiceChoice v-on:ListenChildEvent="showChild" />
showChild: function(data) {
this.sreviceType = data.type_text;
this.status = data.state_text;
},