From 373aa9f5f66054c37cdc83cb60c0c75f1e490a98 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Fri, 19 Feb 2016 11:33:03 +0800 Subject: [PATCH] fix EditorBox string value is not updated bug --- cocos2d/core/components/CCEditBox.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/components/CCEditBox.js b/cocos2d/core/components/CCEditBox.js index 1e767d310a..94e510771c 100644 --- a/cocos2d/core/components/CCEditBox.js +++ b/cocos2d/core/components/CCEditBox.js @@ -44,14 +44,17 @@ var EditBox = cc.Class({ }, properties: { + _string: '', /** * Input string of EditBox. * @property {String} string */ string: { - default: '', - notify: function() { - this._sgNode.string = this.string; + get: function () { + return this._sgNode.string; + }, + set: function(value) { + this._sgNode.string = this._string = value; } }, @@ -226,7 +229,7 @@ var EditBox = cc.Class({ sgNode.inputMode = this.inputMode; sgNode.maxLength = this.maxLength; - sgNode.string = this.string; + sgNode.string = this._string; sgNode.fontSize = this.fontSize; sgNode.fontColor = this.fontColor; sgNode.placeHolder = this.placeHolder;