this.$nextTick( ()=> { let iframe = this.$refs.iframe let that = this; // 判断iframe是否加载完毕 if (!/*@cc_on!@*/0) { // if not IE 判断不是ie iframe.onload = function() { that.loading = false } } else { iframe.onreadystatechange = function() { if (iframe.readyState === 'complete') { that.loading = false } }; } })
为什么用this.$nextTick,因为这个时候iframe是获取不到得