插件名称 | vue-tabevents |
---|---|
发布时间 | 2020年7月8日 |
插件作者 | Almoullim |
Vue 2.x应用程序打开的选项卡的基于事件的通信。
# NPM
$ npm install vue-tabevents --save
向其他选项卡发出事件
this.$tabEvent.emit('eventName');
const data = {
name: 'Ali'
phone: 123
}
this.$tabEvent.emit('eventName', data);
侦听其他类型发出的事件
this.$tabEvent.on('eventName', callback);
this.$tabEvent.on('eventName', (data) => console.log(data));
停止收听事件
this.$tabEvent.off('eventName');