iframe 内嵌页面以及传参

iframe 内嵌页面 传参

//父页面触发
this
.$refs.mainIframe.contentWindow.postMessage(this.showIndex, '*')
//子页面iframe 接收  
mounted() {
    let _this = this
      window.addEventListener('message', function(e) {
        _this.index1 = e.data
        console.log(_this.index1, 'this.index1');
      })
}
posted @ 2022-01-13 10:55  张小中  阅读(285)  评论(0编辑  收藏  举报