cocos creator 通过属性装饰器在编辑器中增加下拉选择属性
// 定义一个枚举作为下拉菜单的选项
enum Shape {
rect,//只能是数字枚举
triangle
}
Enum(Shape);//这步必须
@ccclass('graph')
export class graph extends Component {
@property({ type: Shape})
private shape: Shape = Shape.rect;
// 定义一个枚举作为下拉菜单的选项
enum Shape {
rect,//只能是数字枚举
triangle
}
Enum(Shape);//这步必须
@ccclass('graph')
export class graph extends Component {
@property({ type: Shape})
private shape: Shape = Shape.rect;