💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
[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} }) ```