在使用iframe时,iframe背景为白块,刷新时也会闪过白块。如果刷新时间长,就会一直出现白块;以下是再vue中,再js中同样适用;
<div v-else ref="iframeWanner" v-loading="loading">
<iframe
style="border:none"
width="100%"
allowtransparency="true"
:style=" { visibility:visibiShow }"
:height= iframeHei
ref="iframe"
v-bind:src="reportUrl"
></iframe>
</div>
if (!/*@cc_on!@*/0) { // if not IE 判断不是ie
iframe.onload = function() {
that.visibiShow = 'visible'
that.loading = false
}
} else {
iframe.onreadystatechange = function() {
if (iframe.readyState === 'complete') {
that.visibiShow = 'visible'
that.loading = false
}
};
}

本文探讨了在Vue环境下使用iframe时遇到的背景为白块且刷新时闪烁的问题,提供了针对性的解决方法,确保用户体验不受影响。
1926

被折叠的 条评论
为什么被折叠?



