发布于2026-07-23 阅读(0)
扫一扫,手机访问
跨浏览器标签页通信,这其实是个老生常谈又不得不面对的技术课题。电商后台、在线文档、数据仪表盘,但凡涉及多窗口协同的场景,十个里至少有八个会碰到数据不同步的麻烦。这篇文章就来拆解五种主流的跨标签页通信方案,从原理到代码实战,最后给出清晰的选型建议。
事情还得从现代 Web 应用的一个典型痛点说起——用户频繁地在多个标签页之间切换、操作,而这些页面就像一座座信息孤岛,彼此之间没有任何感知。
典型应用场景:
没有跨页面通信机制时,就只能是这样的局面:
一句话概括,我们需要的是——跨标签页的透明、实时数据同步机制。让用户在不同标签页间的操作感知,就像在同一个页面内一样自然。
在深入每个方案之前,先看一张快速对比表,对整体有个大致了解。
| 特性 | postMessage | MessageChannel | BroadcastChannel | sessionStorage | localStorage |
|---|---|---|---|---|---|
| 通信模式 | 父子单向 | 一对一双向 | 多端广播 | 事件监听 | 事件监听 |
| 需要窗口引用 | ✅ 是 | ✅ 是 | ❌ 否 | ❌ 否 | ❌ 否 |
| 跨源支持 | ✅ 是 | ✅ 是 | ❌ 同源 | ❌ 同源 | ❌ 同源 |
| 窗口刷新后 | ❌ 断开 | ❌ 断开 | ✅ 有效 | ✅ 保留 | ✅ 保留 |
| 实时性 | ✅ 立即 | ✅ 立即 | ✅ 立即 | ⚠️ 延迟 | ⚠️ 延迟 |
| 同页面通信 | ✅ 可以 | ✅ 可以 | ✅ 可以 | ❌ 不能 | ❌ 不能 |
| 实现复杂度 | 中等 | 高 | 低 | 中等 | 中等 |
| 推荐指数 | ⭐⭐ | ⭐ | ⭐⭐⭐⭐⭐ | ⭐ | ⭐ |
结果很明显:对于同源场景,BroadcastChannel 以五颗星的优势胜出。这不是偏见,接下来的对比会让你理解为什么。
postMessage 是最基础的跨窗口通信方式,核心思想是通过向特定窗口的引用发送消息来实现通信。你可以把它想象成——你知道了某个人的地址,于是直接写信过去。
// 发送端(主窗口)
const newWindow = window.open(url, '_blank');
newWindow.postMessage({
type: 'DATA_UPDATE',
data: { id: 123 }
}, '*');
// 接收端(新窗口)
window.addEventListener('message', (event) => {
if (event.origin !== window.location.origin) return;
if (event.data.type === 'DATA_UPDATE') {
console.log('收到数据:', event.data.data);
}
});
| 问题 | 影响 |
|---|---|
| 需要窗口引用 | 主窗口刷新后引用丢失,无法恢复 |
| 新窗口刷新后无法通信 | 需手动重建连接 |
| 新窗口独立打开不支持 | 无法建立通信 |
| 管理复杂 | 多窗口时代码重复且难维护 |
MessageChannel 提供的是真正的一对一、双向通信通道。它通过创建一对端口(Port),一端留在主窗口,另一端传递给目标窗口,从而建立起一条专属通道。
// 发送端(主窗口)
const newWindow = window.open(url, '_blank');
const { port1, port2 } = new MessageChannel();
// 将 port2 传给新窗口
newWindow.postMessage({ port: port2 }, '*', [port2]);
// 通过 port1 收发消息
port1.onmessage = (event) => {
console.log('收到:', event.data);
};
port1.postMessage({ type: 'SYNC', data: {...} });
// 接收端(新窗口)
window.addEventListener('message', (event) => {
if (event.ports.length) {
const port = event.ports[0];
port.onmessage = (msg) => {
console.log('接收到:', msg.data);
};
port.start();
}
});
| 问题 | 影响 |
|---|---|
| 需要管理端口引用 | 引用丢失导致通信断开 |
| 新窗口刷新需重连 | 需额外的重连逻辑 |
| 实现复杂 | 端口转移、start() 等机制容易让人晕头转向 |
| 不支持一对多 | 多窗口需建立多条通道 |
BroadcastChannel 的思路其实很简单:提供一个命名通道,同一浏览器上下文内所有同源的标签页都可以自动订阅这个通道,消息一旦发出,所有监听者都能收到。这就好比在办公室的公共广播里说话,不需要知道谁在听,也不需要知道人在哪——发了就行。
// 发送端(任意窗口)
const channel = new BroadcastChannel('alarm_sync_channel');
channel.postMessage({
alarmId: 123,
deviceId: 456,
devicePath: '/factory/workshop',
deviceName: 'Device-A'
});
// 接收端(所有同源标签页自动接收)
const channel = new BroadcastChannel('alarm_sync_channel');
channel.onmessage = (event) => {
const { alarmId, deviceId, devicePath, deviceName } = event.data;
console.log('自动同步:', { alarmId, deviceId, devicePath, deviceName });
updateDeviceData(deviceId);
};
// 组件卸载时关闭通道
onUnmounted(() => {
channel.close();
});
| 优势 | 说明 |
|---|---|
| 无需窗口引用 | 通过通道名称自动发现,完全解耦 |
| 自动恢复 | 窗口刷新后自动重新连接 |
| 独立打开支持 | 任何方式打开的同源窗口都自动加入 |
| 代码简洁 | API 简单直观,代码量减少 50% 以上 |
| 广播特性 | 一条消息所有监听者都接收 |
| 内存高效 | 无需管理端口生命周期,不易漏泄 |
这两种存储方案的设计初衷是数据持久化,而不是消息通信。拿来当通信工具,就像用冰箱来当暖气——功能是有的,但用着别扭。
核心问题
| 问题 | 说明 | 影响 |
|---|---|---|
| 同页面无法触发事件 | 同一标签页修改 storage 无法通知自己 | 发送端和接收端必须分开 |
| 消息会被覆盖 | 快速发送多条消息时,后面的覆盖前面的 | 需要引入版本号/时间戳机制 |
| 需要轮询 | 无法实时感知更新,需定时检查 | 消耗 CPU,延迟大 |
| 消息易丢失 ⚠️ | 如果接收端未及时检查,消息被覆盖就丢了 | 可能造成 10%+ 的消息丢失 |
| 存储污染 | 大量消息占满 5-10MB 限制 | 影响其他功能的正常使用 |
| 序列化开销 | 频繁 JSON 转换 | 性能下降 |
拿购物车同步的场景打个比方,你会直观地感受到问题的严重性。
假设你在两个浏览器标签页打开了同一个购物应用:标签页 A(购物车) 和 标签页 B(商品详情) 都在监听 storage 事件。
问题发生过程:
时间线 标签页 A(购物车) 标签页 B(商品详情) Storage
────────────────────────────────────────────────────────────────────
T1 用户点击 +5 件商品
├─ sessionStorage.setItem('cart', {productId:1, qty:5})
└─ storage 事件触发 ──────────→ ✅ 收到并更新 UI ← storage 中: {id:1,qty:5}
T2 用户快速再 +3 件
├─ sessionStorage.setItem('cart', {productId:1, qty:8})
└─ storage 事件触发 ──────────→ ⏳ 正在处理 (JS 执行中) ← storage 中: {id:1,qty:8}
(还没来得及读取)
T3 用户再次 +2 件(网络卡顿)
├─ sessionStorage.setItem('cart', {productId:1, qty:10})
└─ storage 事件触发 ──────────→ ? 新事件来了! ← storage 中: {id:1,qty:10}
❌ 之前 T2 的 qty:8 丢失了
T4 标签页 B 事件处理完毕
└─ 从 storage 读取: {id:1, qty:10}
└─ 展示: 购物车中有 10 件商品
└─ 问题: 漏掉了中间的 qty:8 更新!
核心原因:
Storage 设计是覆盖式的
// sessionStorage 只能存一个值
sessionStorage.setItem('cart', data); // 新值覆盖旧值
sessionStorage.getItem('cart'); // 始终只能取到最后一个
// 中间的更新消息丢失了
事件触发滞后
标签页 A 发送消息
↓ (网络/线程延迟)
标签页 B 事件队列
↓ (等待 JS 执行时间)
标签页 B 处理事件
↓
此时已经错过了好几条消息
轮询方式无法捕获所有更新
// 接收端每 500ms 检查一次
setInterval(() => {
const latest = sessionStorage.getItem('cart');
// 问题:如果两次轮询之间发生了多条更新,只能看到最后一条
// 所有中间的更新都丢失了
}, 500);
数据丢失的具体场景
场景 1:高频更新导致的丢失
// 用户在 100ms 内快速修改购物车
for (let i = 0; i < 10; i++) {
sessionStorage.setItem('cart_qty', i);
// 快速写入 0, 1, 2, 3..., 9
}
// 接收端可能只收到:
// - 事件 1:qty = 2
// - 事件 2:qty = 5
// - 事件 3:qty = 9
// 丢失消息数:7 条(70% 丢失率)
场景 2:接收端处理延迟导致的丢失
// 发送端:快速发送 3 条消息
sessionStorage.setItem('msg', {id: 1, data: 'message 1'}); // 时间 T1
sessionStorage.setItem('msg', {id: 2, data: 'message 2'}); // 时间 T2
sessionStorage.setItem('msg', {id: 3, data: 'message 3'}); // 时间 T3
// 接收端的处理时间线:
// T1 时刻:storage 事件触发 → 开始处理第 1 条消息
// T2 时刻:收到新消息,但上一条还没处理完
// T2 + 50ms:处理完第 1 条,但 storage 值已经是第 3 条了
// 结果:消息 2 和消息 3 被合并,实际上只能读到消息 3
// 消息丢失数:2 条(66% 丢失率)
为什么 BroadcastChannel 不会丢失
// BroadcastChannel 有事件队列机制
const channel = new BroadcastChannel('sync');
// 即使接收端忙,消息也会被排队
channel.postMessage({id: 1}); // ✅ 队列中
channel.postMessage({id: 2}); // ✅ 队列中
channel.postMessage({id: 3}); // ✅ 队列中
channel.onmessage = (event) => {
// 每条消息都会触发单独的事件
console.log(event.data.id); // 输出: 1, 2, 3 (无丢失)
};
对比总结:
| 方案 | 消息处理方式 | 丢失率 | 原因 |
|---|---|---|---|
| Storage | 覆盖式存储 + 事件 | 10-70% | 中间消息被覆盖,轮询也无法捕获 |
| BroadcastChannel | 事件队列 | 0% | 每条消息都有独立事件,保证送达 |
| postMessage | 消息队列 | 0% | 浏览器保证消息顺序和送达 |
| MessageChannel | 端口队列 | 0% | 双向可靠通道 |
完整实现示例(仍然不推荐)
// ========== 消息队列包装类 ==========
class StorageMessageQueue {
constructor(channelName = 'message_queue') {
this.channelName = channelName;
this.messageId = 0;
this.listeners = [];
this.setupListener();
}
setupListener() {
window.addEventListener('storage', (event) => {
if (event.key === this.channelName && event.newValue) {
const message = JSON.parse(event.newValue);
this.listeners.forEach(cb => cb(message));
// 清理消息
sessionStorage.removeItem(this.channelName);
}
});
}
send(data) {
const message = {
id: ++this.messageId,
timestamp: Date.now(),
data,
};
sessionStorage.setItem(this.channelName, JSON.stringify(message));
}
onMessage(callback) {
this.listeners.push(callback);
}
close() {
this.listeners = [];
}
}
// ========== 使用方式 ==========
// 发送端
const queue = new StorageMessageQueue('alarm_sync');
function nextAlarm(row) {
queue.send({
alarmId: row.id,
deviceId: row.deviceId,
});
}
// 接收端
const queue = new StorageMessageQueue('alarm_sync');
queue.onMessage((message) => {
updateDevice(message.data.deviceId);
});
问题:
用户场景:主窗口在处理报警,新窗口打开了诊断页面。此时主窗口突然意外刷新——通信还能恢复吗?
postMessage 方案
// ❌ 主窗口刷新后,newWindow 引用丢失 const newWindow = window.open(url); // 页面刷新... // newWindow 变量被重置,无法继续通信
MessageChannel 方案
// ⚠️ 需要重新建立连接 // 主窗口刷新后,原有 port1 失效 // 需要额外的重连机制,增加复杂度
BroadcastChannel 方案 ⭐
// ✅ 自动恢复
const channel = new BroadcastChannel('alarm_sync_channel');
// 页面刷新...
// 自动重新连接到通道
channel.postMessage(data); // 可以继续使用
sessionStorage 方案
// ⚠️ 数据保留,但需轮询
sessionStorage.setItem('alarm_sync', JSON.stringify(data));
// 页面刷新...
// 数据仍在,但接收端需轮询检测版本号
let lastId = 0;
setInterval(() => {
const msg = JSON.parse(sessionStorage.getItem('alarm_sync'));
if (msg?.id > lastId) {
lastId = msg.id;
updateDevice(msg.deviceId);
}
}, 500); // 延迟 500ms 才能感知
用户场景:用户直接通过地址栏输入 URL,独立打开了一个新标签页——之前没有主窗口传递引用,通信还能建立吗?
postMessage 方案
// ❌ 无法建立通信 // 主窗口没有对新窗口的引用 // 新页面无法与主窗口通信
MessageChannel 方案
// ❌ 无法直接通信 // 新窗口不知道要连接到哪个通道
BroadcastChannel 方案 ⭐
// ✅ 自动连接
const channel = new BroadcastChannel('alarm_sync_channel');
channel.onmessage = (event) => {
// 自动接收其他标签页的消息,无需任何额外配置
};
sessionStorage 方案
// ⚠️ 可见数据,但无法感知更新
const data = JSON.parse(sessionStorage.getItem('alarm_sync'));
// 问题:新窗口打开后,无法知道 "有新消息来了"
// 需要定时轮询或使用其他机制通知
用户场景:用户同时打开了 3 个诊断页面,需要它们共享同一个设备的数据更新。
postMessage 方案
// ❌ 无法实现优雅 const window1 = window.open(url1); const window2 = window.open(url2); const window3 = window.open(url3); // 发送消息时需要逐一发送 window1.postMessage(data, '*'); window2.postMessage(data, '*'); window3.postMessage(data, '*'); // 代码重复,难以维护
MessageChannel 方案
// ⚠️ 可以但复杂
// 需要为每个窗口建立单独的 MessageChannel
const { port1: port1_w1, port2: port2_w1 } = new MessageChannel();
const { port1: port1_w2, port2: port2_w2 } = new MessageChannel();
const { port1: port1_w3, port2: port2_w3 } = new MessageChannel();
// 分别初始化每个连接
window1.postMessage({ port: port2_w1 }, '*', [port2_w1]);
window2.postMessage({ port: port2_w2 }, '*', [port2_w2]);
window3.postMessage({ port: port2_w3 }, '*', [port2_w3]);
// 发送消息时仍需逐一发送
port1_w1.postMessage(data);
port1_w2.postMessage(data);
port1_w3.postMessage(data);
BroadcastChannel 方案 ⭐
// ✅ 完美支持
const channel = new BroadcastChannel('alarm_sync_channel');
// 所有 3 个诊断页面都自动监听同一通道
// 发送一条消息,所有监听者都接收
channel.postMessage(data);
// 简洁、高效、完全自动化
sessionStorage 方案
// ⚠️ 可以但需复杂逻辑
sessionStorage.setItem('alarm_sync_v2', JSON.stringify({
version: Date.now(),
data: { deviceId: 456 }
}));
// 3 个窗口都需要定时轮询
let lastVersion = 0;
setInterval(() => {
const stored = JSON.parse(sessionStorage.getItem('alarm_sync_v2') || '{}');
if (stored.version && stored.version > lastVersion) {
lastVersion = stored.version;
updateDevice(stored.data.deviceId);
}
}, 500);
// 问题:3 个窗口都在轮询,消耗 CPU
// 有消息丢失风险(版本号被覆盖)
假设你在购物应用中同时打开了两个标签页:
需求:
┌─────────────────────────────────────┐
│ cart.vue (标签页 A) │
│ 用户修改购物车商品数量 │
│ ↓ │
│ updateItemQuantity(item) 更新本地 │
│ ↓ │
│ ? syncChannel.postMessage() │
│ 发送 {productId, quantity, ...} │
└────────────┬──────────────────────┘
│ BroadcastChannel
↓
┌─────────────────────────────────────┐
│ productDetail.vue (标签页 B) │
│ │
│ syncChannel.onmessage 触发 │
│ ↓ │
│ ? router.replace() 更新 URL │
│ ↓ │
│ ? loadProductDetail() 重新加载 │
│ ↓ │
│ ✅ 两个标签页购物数据完全同步 │
└─────────────────────────────────────┘
// ✅ 推荐:使用明确的命名规范
const CHANNEL_NAMES = {
SHOPPING_SYNC: 'shopping_sync_channel',
USER_PROFILE: 'user_profile_sync',
NOTIFICATION_UPDATE: 'notification_update',
DATA_DASHBOARD: 'data_dashboard_sync',
};
const channel = new BroadcastChannel(CHANNEL_NAMES.SHOPPING_SYNC);
onMounted(() => {
channel = new BroadcastChannel('sync_channel');
channel.onmessage = handleMessage;
});
onUnmounted(() => {
// ✅ 必须关闭,否则会泄漏内存
channel.close();
channel = null;
});
// ✅ 使用 router.replace() 而非 push()
// 这样刷新后能恢复到正确的状态
router.replace({
path: routes.path,
query: {
...routes.query,
deviceId,
},
});
// ✅ 只传递必要数据,减少序列化开销
syncChannel.postMessage({
type: 'CART_UPDATED',
productId: item.productId,
quantity: newQuantity,
price: item.price,
timestamp: Date.now(),
});
// ❌ 避免:传递整个商品对象(包含无关信息)
// syncChannel.postMessage(item);
// BroadcastChannel 仅支持同源通信 // 浏览器自动规避安全隐患,无需手动检查 // 不同源的页面无法访问该通道 // 如果需要跨源,使用 postMessage: if (event.origin !== window.location.origin) return;
| 浏览器 | postMessage | MessageChannel | BroadcastChannel | Storage |
|---|---|---|---|---|
| Chrome | ✅ 全版本 | ✅ 全版本 | ✅ 54+ | ✅ 全版本 |
| Firefox | ✅ 全版本 | ✅ 全版本 | ✅ 38+ | ✅ 全版本 |
| Safari | ✅ 全版本 | ✅ 全版本 | ✅ 15.1+ | ✅ 全版本 |
| Edge | ✅ 全版本 | ✅ 全版本 | ✅ 79+ | ✅ 全版本 |
| IE | ✅ 11+ | ✅ 11+ | ❌ 不支持 | ✅ 8+ |
处理兼容性
// 检测 BroadcastChannel 支持
if (typeof BroadcastChannel !== 'undefined') {
// 使用 BroadcastChannel
const channel = new BroadcastChannel('sync');
} else {
// 降级方案:使用 postMessage 或 localStorage
console.warn('浏览器不支持 BroadcastChannel,使用降级方案');
}
需要跨标签页通信吗?
├─ 不需要 → 使用本地 Vue 状态管理
└─ 需要
├─ 需要跨源吗?
│ ├─ 是 → 使用 postMessage 或 MessageChannel
│ └─ 否
│ ├─ 需要实时通信吗?
│ │ ├─ 是 → ? 使用 BroadcastChannel
│ │ └─ 否
│ │ ├─ 需要数据持久化吗?
│ │ │ ├─ 是 → localStorage + BroadcastChannel
│ │ │ └─ 否 → sessionStorage + 轮询(不推荐)
| 场景 | 推荐方案 | 理由 |
|---|---|---|
| 实时同步(同源) | BroadcastChannel | 简洁、高效、无需轮询 |
| 数据持久化+实时同步 | localStorage + BroadcastChannel | 数据持久 + 实时通知 |
| 跨源通信 | postMessage | 唯一支持跨源的方案 |
| 点对点可靠通信 | MessageChannel | 双向可靠通道 |
| 浏览器兼容性最高 | postMessage | 最广泛的浏览器支持 |
| 不推荐 | Storage 作消息队列 | 需轮询、易丢失、难维护 |
Q1: 为什么 BroadcastChannel 收不到消息?
A: 检查以下几点:
channel.close()A: 因为 Storage 的设计本就不是为了消息通信:
这就是为什么 BroadcastChannel 被设计出来的原因。
Q3: localStorage 可以用于跨标签页通信吗?
A: 可以,但不推荐作为主要通信机制:
适用场景:
Q4: 如何实现跨源通信?
A: 使用 postMessage 或 MessageChannel,但要注意安全性:
// postMessage 跨源通信
newWindow.postMessage(data, 'https://trusted-domain.com');
// 接收端必须验证来源
window.addEventListener('message', (event) => {
if (event.origin !== 'https://trusted-domain.com') return;
// 安全处理消息
});
Q5: BroadcastChannel 中的错误如何处理?
A: 监听 messageerror 事件:
channel.onmessageerror = (event) => {
console.error('消息解析错误:', event);
};
// 或使用 addEventListener
channel.addEventListener('messageerror', (event) => {
console.error('消息错误:', event);
});
BroadcastChannel 的应用远不止跨标签页数据同步,还包括:
// 多个门店系统标签页同时打开
const inventoryChannel = new BroadcastChannel('inventory_sync');
// 门店 A 在标签页 1 扫描商品入库
inventoryChannel.postMessage({
type: 'STOCK_IN',
productId: 'SKU-123',
quantity: 50,
location: 'warehouse-1',
timestamp: Date.now(),
});
// 门店 B 在标签页 2 自动收到更新
inventoryChannel.onmessage = (event) => {
if (event.data.type === 'STOCK_IN') {
updateInventory(event.data);
showNotification(`库存已更新:${event.data.quantity}件`);
}
};
const orderChannel = new BroadcastChannel('order_sync');
// 后台管理页面在标签页 1 更新订单状态
orderChannel.postMessage({
orderId: 'ORD-2024-001',
status: 'shipped',
trackingNo: 'TRK123456',
updatedAt: Date.now(),
});
// 客服页面在标签页 2 自动获取最新状态
orderChannel.onmessage = (event) => {
updateOrderUI(event.data);
notifyCustomer(`订单 ${event.data.orderId} 已${event.data.status}`);
};
const userSettingsChannel = new BroadcastChannel('user_settings_sync');
// 用户在账户设置页面(标签页 1)修改主题
userSettingsChannel.postMessage({
type: 'THEME_CHANGED',
theme: 'dark',
userId: '12345',
});
// 所有打开的应用页面(标签页 2、3、4...)自动同步
userSettingsChannel.onmessage = (event) => {
if (event.data.type === 'THEME_CHANGED') {
applyTheme(event.data.theme);
showMessage('主题已切换为深色模式');
}
};
const dashboardChannel = new BroadcastChannel('analytics_dashboard');
// 数据分析工具在后台收集数据(标签页 1)
dashboardChannel.postMessage({
metric: 'daily_sales',
value: 15000,
region: 'east',
timestamp: Date.now(),
});
// 多个仪表板视图(标签页 2、3、4...)自动刷新
dashboardChannel.onmessage = (event) => {
updateChart(event.data);
updateDataCard(event.data);
playNotificationSound(); // 新数据到达时提醒
};
BroadcastChannel 代表了现代 Web 应用通信的最佳实践——简洁、高效、易维护。那些追求稳定可靠的同源应用场景,完全可以毫不犹豫地选择它。
通过深入理解这五种跨窗口通信方案的优劣,我们可以在实际项目中做出更精准的技术选型。一个正确的通信机制,往往是系统可靠性的基石——它不会经常成为问题,但一旦出问题,往往是大问题。
关键要点:
| 维度 | postMessage | MessageChannel | BroadcastChannel | sessionStorage | localStorage |
|---|---|---|---|---|---|
| 代码行数 | 20-30 | 40-50 | 10-15 | 30-40 | 30-40 |
| 学习难度 | 低 | 高 | 低 | 低 | 低 |
| 实时性 | ms 级 | ms 级 | ms 级 | 秒级+ | 秒级+ |
| 可靠性 | 高 | 高 | 高 | 低 | 低 |
| 内存效率 | 好 | 中 | 好 | 差 | 差 |
| 消息丢失率 | 0% | 0% | 0% | 10%+ | 10%+ |
| 性能评分 | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐ | ⭐ |
| 综合评分 | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐ | ⭐ |
BroadcastChannel(3 行)
const ch = new BroadcastChannel('sync');
ch.postMessage(data);
ch.onmessage = (e) => handle(e.data);
sessionStorage(15+ 行)
const queue = new StorageMessageQueue('sync');
queue.send(data);
queue.onMessage(handle);
postMessage(25+ 行)
const win = window.open(url);
win.postMessage(data, '*');
window.addEventListener('message', (e) => handle(e.data));
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
8