# Target

When the front-end plug-in is set to communicate with each other, the following methods must be set

Import the necessary libraries:

import { getCurrentInstance } from 'vue';

Sender:

const { proxy }: any = getCurrentInstance();
proxy.$pubsub.publish('自定义事件方法名', 自定义传参);

img1.png

Recipient:

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

});

img2.png

# 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.

img3.png