Commit 698cc0e8 authored by asdf's avatar asdf

iframe添加监听

parent f1e15910
...@@ -122,9 +122,8 @@ cc.Class({ ...@@ -122,9 +122,8 @@ cc.Class({
this.preloadItem() this.preloadItem()
} }
}) })
var testiframe = document.getElementById("previewFrame"); if (window.parent) {
if (testiframe) { window.parent.addEventListener('message', (e) => {
testiframe.contentWindow.addEventListener('message', (e) => {
let msgData = e.data; let msgData = e.data;
console.log(msgData.action) console.log(msgData.action)
if (msgData.action === "course-ready") { if (msgData.action === "course-ready") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment