class Enum {
constructor(key,val) {
this.#key = key;
this.#val = val;
}
/**
* 枚举类型的key
*/
#key;
/**
* 枚举类型的值
*/
#val;
get val() {
return this.#val;
}
}
export class SystemMessageEnum {
#map = new Map();
constructor() {
this.enums("TRADE",new Enum(1,"交易通知"));
this.enums("BINDDING",new Enum(2,"竞标消息"));
this.enums("NOTICE",new Enum(3,"系统通知"));
this.enums("ACTIVITY",new Enum(4,"优惠活动"));
this.enums("PAY",new Enum(5,"收费通知"));
}
val(key) {
return this.#map[key];
}
enums(type,content) {
console.log(type)
console.log(content)
this.#map[type] = content;
}
}
vue 枚举类
最新推荐文章于 2024-08-13 15:56:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)