Target
When the front-end plug-in is set to communicate with each other, the following methods must be set
Import the necessary libraries:
js
import { getCurrentInstance } from 'vue';Sender:
js
const { proxy }: any = getCurrentInstance();
proxy.$pubsub.publish('自定义事件方法名', 自定义传参);
Recipient:
js
const { proxy }: any = getCurrentInstance();
proxy.$pubsub.subscribe('自定义事件方法名', (msgName, data) => {
});
Process
Through a message broker, the sender sends the message to the transfer station and the receiver receives the message from the broker station, enabling communication.
