From 2e76d5702608d63712cb31ad2977617e99e46ad3 Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 26 Apr 2022 11:38:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=20computed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ResultArea.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/ResultArea.vue b/src/components/ResultArea.vue index 9e62679..f912c1a 100644 --- a/src/components/ResultArea.vue +++ b/src/components/ResultArea.vue @@ -58,9 +58,6 @@ export default { frameInitHeight: Number, }, computed: { - cfw() { - return this.$refs?.iframe?.contentWindow; - }, showFrame() { return this.enableHtml && this.runResultStatus; }, @@ -79,17 +76,18 @@ export default { }, methods: { frameInit() { - if (!this.cfw) return; + let cfw = this.$refs?.iframe?.contentWindow; + if (!cfw) return; let ctx = { quickcommand: _.cloneDeep(quickcommand), utools: _.cloneDeep(utools), parent: undefined, }; - Object.assign(this.cfw, ctx); - this.cfw.onload = () => { + Object.assign(cfw, ctx); + cfw.onload = () => { this.frameHeight = Math.min( - this.cfw.document.body.innerText - ? this.cfw.document.documentElement.getBoundingClientRect().height + cfw.document.body.innerText + ? cfw.document.documentElement.getBoundingClientRect().height : 0, this.maxHeight );