【发布时间】:2019-05-27 12:06:58
【问题描述】:
我有一个组件,它有时被用作父级的子级,有时它没有任何父级。
此组件发出一个特定事件,该事件要么被父级捕获(如果已订阅),要么我想由此组件本身处理。
所以在运行时,我如何以编程方式检查
if (someone is listening to the event){
let them catch and handle it
}else {
let's handle it by our own
}
【问题讨论】:
标签: javascript vue.js vuejs2 vue-component