码迷,mamicode.com
首页 > 其他好文 > 详细

getOwnPropertyDescriptor使用

时间:2019-01-28 15:07:17      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:ring   script   his   call   defaults   property   str   label   tco   

var descriptor, label, set;

descriptor = Object.getOwnPropertyDescriptor(cc.Label.prototype, "string");

descriptor = lo.defaults({}, descriptor);

set = descriptor.set;

descriptor.set = function(string) {
  return set.call(this, "123");
};

label = this.node.getComponent(cc.Label);

Object.defineProperty(label, "string", descriptor);

label.string = label.string

getOwnPropertyDescriptor使用

标签:ring   script   his   call   defaults   property   str   label   tco   

原文地址:https://www.cnblogs.com/xyptechnology/p/10329893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!