企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[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} }) ```