Skip to main content
Version: 3.4

Enum 枚举

1. 结构声明

class Enum extends BaseNode {
name: string = '';
label: string;
description: string;
enumItems: Array<EnumItem>;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "Enum",
"name": "ProductStatus",
"label": "",
"description": "",
"enumItems": [
{
"concept": "EnumItem",
"value": "Listing",
"label": "上架"
},
{
"concept": "EnumItem",
"value": "Delisting",
"label": "下架"
}
]
}

(2) 带描述的示例

AST 如下:

{
"concept": "Enum",
"name": "ProductStatus",
"label": "商品状态",
"description": "表示商品状态的枚举",
"enumItems": [
{
"concept": "EnumItem",
"value": "Listing",
"label": "上架"
},
{
"concept": "EnumItem",
"value": "Delisting",
"label": "下架"
}
]
}