无法使用get set 访问器

发布于 7 年前作者 xiulan7618220 次浏览最后编辑 7 年前来自 ask

Object.defineProperty(TestPage.prototype, “text”, {        get: function () {            return this.data.text;        },        set: function (text) {            console.log(“text”, text);            this.setData({                text: text            });        },        enumerable: true,        configurable: true    });

当给 text赋值的时候,并不能调用set:function(text){}

0 回复
暂无回复