html

<main>
  <img v-show="!completeLoad" src="../images/loading.gif"/>
  <iframe v-show="completeLoad" :src="url" width="100%" id="license_iframe" height="100%"></iframe>
</main>

js

mounted () {
	var _this = this
	const iframe = document.querySelector('#license_iframe')
	// 处理兼容行问题
	if (iframe.attachEvent) {
		iframe.attachEvent('onload', function () {
			console.log('iframe已加载完毕')
			_this.completeLoad = true;
        })
    } else {
        iframe.onload = function () {
            console.log('iframe已加载完毕')
            _this.completeLoad = true;
        }
    }
}
Logo

前往低代码交流专区

更多推荐