<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; const that = this; if (iframe.attachEvent) { // IE iframe.attachEvent('onload', () => { that.stateChange(); }); } else {// not IE ifame. Onload = function () {that.statechange (); }; } }, methods: { stateChange() { this.loading = false; ,}}}; </script> <style scoped></style>Copy the code