TypeScript 如何 写一个组件 继承自 cc.Widget 隐藏属性?

const { ccclass, property } = cc._decorator;
@ccclass
export default class ContentAdapter extends cc.Widget {
@property({
tooltip:“距离顶部边界多少像素”,
type:0,
visible:false,
override:false,
})
top:number = 0;
@property({
tooltip:“距离底部边界多少像素”,
type:0,
})
bottom:number = 0;
@property({
tooltip:“距离左边界多少像素”,
type:0,
})
left:number = 0;
@property({
tooltip:“距离右边界多少像素”,
type:0,
})
right:number = 0;
@property({
tooltip:“决定 Widget 应该何时刷新”,
type:cc.Widget.AlignMode,
})
alignMode:number = cc.Widget.AlignMode.ON_WINDOW_RESIZE;
// private widget:cc.Widget;
onLoad() {
// this.widget = this.addComponent(cc.Widget);
// this.widget.target = this.node;
// this.widget.top = this.top;
// this.widget.bottom = this.bottom;
// this.widget.left = this.left;
// this.widget.right = this.right;
// this.widget.alignMode = this.alignMode;
}
}

我写 了 override 和 visible 还是报错

Can not declare ContentAdapter.top, it is already defined in the prototype of ContentAdapter

Can not declare ContentAdapter.bottom, it is already defined in the prototype of ContentAdapter

Can not declare ContentAdapter.left, it is already defined in the prototype of ContentAdapter

Can not declare ContentAdapter.right, it is already defined in the prototype of ContentAdapter

主要看 top

请问 是我写的不对吗 还是官方给的办法不能用啊?

@jare @cary @339698778 同问一下

解决了吗?