给visible加一个参数表示this,就能用箭头函数了,看上去简洁点
@property({ visible: function () { return this.type === dirEnum.HORIZONTAL } })
// 给visible加一个this参数
@property({ visible: self => self.type === dirEnum.HORIZONTAL })
property修饰get/set,参数为什么不支持简写呢?
@property
private _target: cc.Node = null;
@property({ type: cc.Node }) // 这里不能简写
get target() { return this._target || this.node || null; }
set target(value) { this._target = value; }