From 43c1aaee821313d684bca22eeef8c36461c6729e Mon Sep 17 00:00:00 2001 From: redhoodsu Date: Fri, 1 Nov 2019 20:07:31 +0800 Subject: [PATCH] fix(console): rendering --- src/Console/Console.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Console/Console.js b/src/Console/Console.js index 09cebe0..e3087b2 100644 --- a/src/Console/Console.js +++ b/src/Console/Console.js @@ -29,6 +29,10 @@ export default class Console extends Tool { init($el, container) { super.init($el) this._container = container + this._handleShow = () => { + if (!this.active) return + this._logger.renderViewport() + } this._appendTpl() @@ -41,7 +45,7 @@ export default class Console extends Tool { } show() { super.show() - this._logger.renderViewport() + this._handleShow() } overrideConsole() { const origConsole = (this._origConsole = {}) @@ -88,6 +92,8 @@ export default class Console extends Tool { this._logger.destroy() super.destroy() + this._container.off('show', this._handleShow) + evalCss.remove(this._style) this.ignoreGlobalErr() this.restoreConsole() @@ -199,6 +205,8 @@ export default class Console extends Tool { if (autoShow) container.showTool('console').show() }) + + container.on('show', this._handleShow) } _hideInput() { this._$inputContainer.css({