<template>
<div style="height:100%;overflow: auto;" v-loading="loading">
<iframe ref="iframe" :src="src" width="100%" height="100%" frameborder="0"></iframe>
</div>
</template>
<script>
export default {
data() {
return {
src: 'https://www.baidu.com',
loading: true,
};
},
created() {
},
mounted() {
const { iframe } = this.$refs;
const that = this;
if (iframe.attachEvent) {
iframe.attachEvent('onload', () => {
that.stateChange();
});
} else {
iframe.onload = function () {
that.stateChange();
};
}
},
methods: {
stateChange() {
this.loading = false;
},
},
};
</script>
<style scoped></style>