多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[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} }) ```