🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] > [参考](https://docs.plasmo.com/framework/messaging) ## 概述 用于在各个模块间通信 安装 ``` npm install @plasmohq/messaging ``` ## Message Flow background/messages/ping.ts ``` import type { PlasmoMessaging } from "@plasmohq/messaging" export const handler: PlasmoMessaging.MessageHandler = async (req, res) => { const message = req.body.id res.send({ message }) } ``` popup.vue ``` sendToBackground({ name: "ping", body: { id: 123 } }).then(resp=>{ alert(JSON.stringify(resp)) // {"message":123} }) ```