vue 子元件呼叫父元件方法
阿新 • • 發佈:2019-01-27
父元件vue
<privateScoreTop :msg ="Widget" v-on:listenTochildEvent="showMessageFromChild">
</privateScoreTop>
父元件js
export default{
data(){
return {
}
},
computed:{
privateScoreTop : ()=>import("./privateScoreTop.vue")
},
mounted(){
},
methods :{
showMessageFromChild(data){
console.log("回掉子元件成功"+data);
}
}
}
子元件js
export default{
methods: {
onfilter(){
this.$emit("listenTochildEvent",{回傳引數});
},
}
}