@howlove/enum
v0.0.6
Published
```javascript const verifyStatusEnum = createEnum({ wait: { label: "等待", value: 0, idx: 1, }, pass: { label: "通过", value: 1, idx: 2, }, reject: { label: "拒绝", value: 2, idx: 3, }, init: { label: { text: "支付取消", status: "Su
Downloads
2
Readme
使用 demo
const verifyStatusEnum = createEnum({
wait: {
label: "等待",
value: 0,
idx: 1,
},
pass: {
label: "通过",
value: 1,
idx: 2,
},
reject: {
label: "拒绝",
value: 2,
idx: 3,
},
init: {
label: {
text: "支付取消",
status: "Success",
},
value: 3,
idx: 4,
},
} as const);
// result -> 0
verifyStatusEnum.wait
// result -> 等待
verifyStatusEnum.waitName
// result -> { wait: '等待', pass: '通过', reject: '拒绝', init: { text: '支付取消', status: 'Success' } }
verifyStatusEnum.enum
// result -> { wait: '等待', pass: '通过', reject: '拒绝', init: '支付取消' }
verifyStatusEnum.textEnum
/**
*
[
{ label: '等待', value: 0, idx: 1 },
{ label: '通过', value: 1, idx: 2 },
{ label: '拒绝', value: 2, idx: 3 },
{ label: { text: '支付取消', status: 'Success' }, value: 3, idx: 4 }
]
*/
verifyStatusEnum.options
更新备注
0.0.3 ---------- 2023-12-14 15:37:44
更新内容: 枚举的key应该是value值
0.0.5 ---------- 2023/12/19 20:26:13
更新内容: labelType的text改为any类型,就可以传dom或者其他类型进来