Browse Source

嵌入

shibei_master
dai 3 years ago
parent
commit
3b3bc96ec5
  1. 29
      src/views/main-shuju/main-content.vue

29
src/views/main-shuju/main-content.vue

@ -11,17 +11,16 @@
'&customerId=' + '&customerId=' +
customerId customerId
" "
ref="iframes" ref="iframe"
class="m-iframe" class="m-iframe"
id="iframes" id="iframe"
width="100%" width="100%"
height="100%" height="100%"
style=""
frameborder="0" frameborder="0"
scrolling="yes" scrolling="yes"
></iframe> />
</template> </template>
<keep-alive v-else> <keep-alive v-show="!tabIsIframe($router.currentRoute.meta.iframeURL)">
<router-view @changeCustomerName="changeCustomerName" /> <router-view @changeCustomerName="changeCustomerName" />
</keep-alive> </keep-alive>
</template> </template>
@ -39,10 +38,12 @@ export default {
customerId: "", customerId: "",
}; };
}, },
watch: {
// "$router.currentRoute.name": function () {
// console.log($router.currentRoute);
// },
},
created() { created() {
// this.$nextTick(() => {
// this.sendMessage()
// })
this.token = localStorage.getItem("token"); this.token = localStorage.getItem("token");
this.customerId = localStorage.getItem("customerId"); this.customerId = localStorage.getItem("customerId");
}, },
@ -118,18 +119,6 @@ export default {
); );
this.$router.push({ name: "home" }); this.$router.push({ name: "home" });
}, },
sendMessage() {
// const iframe = this.$refs.iframes.contentWindow
const iframe =
document.getElementsByClassName("iframes")[0].contentWindow;
console.log("iframe", iframe);
// iframe.postMessage({
// token: localStorage.getItem('token'),
// customerId: localStorage.getItem('customerId')
// }, '*')
iframe.postMessage({ name: "lalalal" }, "*");
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save