this.$on可以监听一个自定义事件,当事件被触发时执行相应的处理函数。
监听
export default {
onShow(){
this.$on('back',(res)=>{
console.log('监听到了')
})
}
}
发送
this.$emit('back',{id:1})
this.$on可以监听一个自定义事件,当事件被触发时执行相应的处理函数。
监听
export default {
onShow(){
this.$on('back',(res)=>{
console.log('监听到了')
})
}
}
发送
this.$emit('back',{id:1})