From 14efc39a99eb977fbffc8be34d9c6be8a1b203b0 Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Sat, 8 Sep 2018 12:24:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A7=E4=BB=B6bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/src/component/BasicComponent.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ShadowEditor.Web/src/component/BasicComponent.js b/ShadowEditor.Web/src/component/BasicComponent.js index fa61c1db..dc8ead60 100644 --- a/ShadowEditor.Web/src/component/BasicComponent.js +++ b/ShadowEditor.Web/src/component/BasicComponent.js @@ -7,6 +7,7 @@ import SetValueCommand from '../command/SetValueCommand'; */ function BasicComponent(options) { BaseComponent.call(this, options); + this.selected = null; } BasicComponent.prototype = Object.create(BaseComponent.prototype); @@ -87,16 +88,16 @@ BasicComponent.prototype.updateUI = function () { return; } - var selected = editor.selected; - UI.get('objectName', this.id).setValue(selected.name); - UI.get('objectType', this.id).setValue(selected.constructor.name); + this.selected = editor.selected; + UI.get('objectName', this.id).setValue(this.selected.name); + UI.get('objectType', this.id).setValue(this.selected.constructor.name); }; BasicComponent.prototype.onChangeName = function () { var objectName = UI.get('objectName', this.id); var editor = this.app.editor; - editor.execute(new SetValueCommand(editor.selected, 'name', objectName.getValue())); + editor.execute(new SetValueCommand(this.selected, 'name', objectName.getValue())); }; export default BasicComponent; \ No newline at end of file