# 目标
前端插件,设置到互相之间需要通信时,需设置以下方式
导入必要库:
import { getCurrentInstance } from 'vue';
发送方:
const { proxy }: any = getCurrentInstance();
proxy.$pubsub.publish('自定义事件方法名', 自定义传参);

接收方:
const { proxy }: any = getCurrentInstance();
proxy.$pubsub.subscribe('自定义事件方法名', (msgName, data) => {
});

# 流程
通过一个消息中转站,发送方将消息发送到中转站,接收方从中转站接收消息,从而实现通信。

← 样式可配置