From da4055d1f56ab19a0b51a03214ec697a3d7a2027 Mon Sep 17 00:00:00 2001 From: fayeah <411596701@qq.com> Date: Fri, 11 Sep 2020 19:04:29 +0800 Subject: [PATCH] Update printarea.js use es6 syntax and change variable which is not immutable from let to const --- src/packages/printarea.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/packages/printarea.js b/src/packages/printarea.js index cea7bdc..7358084 100644 --- a/src/packages/printarea.js +++ b/src/packages/printarea.js @@ -23,11 +23,11 @@ export default class { init() { this.counter++; this.settings.id = `printArea_${this.counter}`; - let PrintAreaWindow = this.getPrintWindow(); // 创建iframe + const PrintAreaWindow = this.getPrintWindow(); // 创建iframe this.write(PrintAreaWindow.doc); // 写入内容 this.print(PrintAreaWindow); this.settings.endCallback(); - + } print(PAWindow) { let paWindow = PAWindow.win; @@ -214,9 +214,9 @@ export default class { }; } Iframe() { - let frameId = this.settings.id; + const frameId = this.settings.id; let iframe; - let that = this + const that = this; try { iframe = document.createElement('iframe'); document.body.appendChild(iframe); @@ -231,7 +231,7 @@ export default class { iframe.doc = null; iframe.doc = iframe.contentDocument ? iframe.contentDocument : (iframe.contentWindow ? iframe.contentWindow.document : iframe.document); iframe.onload = function () { - var win = iframe.contentWindow || iframe; + const win = iframe.contentWindow || iframe; that.print(win); } } catch (e) { @@ -244,4 +244,4 @@ export default class { return iframe; } -} \ No newline at end of file +}