sailei1 / blog

1 stars 0 forks source link

iframe 多子窗口通信 #110

Closed sailei1 closed 3 years ago

sailei1 commented 3 years ago
// 接收页面
window.addEventListener('storage', function (e) {
      if (e.key == 'xxx') {
        console.log(e.newValue);

       // 用完移除  localStorage.removeItem('xxx');
       }
    });
//触发页面
localStorage.setItem('xxx',JSON.stringify({...}))