Commit a8bbc6ed authored by 黄奎's avatar 黄奎

新增Iframe自适应高度

parent 7ca4d429
......@@ -194,7 +194,7 @@
<!-- ppt 模版行程 -->
<div v-if="FeatureData.FeatureType==9&&FeatureDataFlag" v-loading="iframeLoading">
<iframe name="myIframe" :src="myIframeUrl" style="width: 100%;border: 0;"
:style="{'height':myIframeHeigth+'px'}">
:style="{'height':myIframeHeigth+'px'}" @load="resizeIframe">
</iframe>
<!-- <div v-if="FeatureData.TripImageListNew&&FeatureData.TripImageListNew.length>0">
<template v-for="url in FeatureData.TripImageListNew">
......@@ -373,6 +373,17 @@
},
methods: {
resizeIframe() {
const iframe = document.getElementsByName("myIframe");
if (iframe) {
const iframeWindow = iframe.contentWindow;
if (iframeWindow && iframeWindow.document && iframeWindow.document.readyState === 'complete') {
const body = iframeWindow.document.body;
const viewportHeight = iframeWindow.innerHeight;
this.myIframeHeigth = body.scrollHeight || viewportHeight;
}
}
},
//图片左移右移
ExchangeImg(type, index, IsMove) {
if (type == 1) {
......@@ -438,6 +449,7 @@
this.myIframeHeigth = datas[1];
this.isPostMessage = true
}
if (this.myIframeUrl && this.myIframeUrl != '') {
document.all.myIframe.src = this.myIframeUrl + `&t=${new Date().getTime()}`
}
......
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