# 监听指令 2024.3+
用于监听外部发送的指令。
# 基本信息
特性 | 说明 |
---|---|
是否支持添加多个 | ✔️ |
是否有配置项 | ❌ |
监听指令
# 示例
# 1.在其他页面中添加发送指令事件
const iframe = document.getElementsById("iframe");
// 指令接收的数据对象
const commandObj = {
hetu: {
command: '饼图'
}
};
// 发送指令
iframe.contentWindow.postMessage(
commandObj,
"*"
);