ts 的枚举类型
枚举类型默认从 0 开始
enum SexType { BOY, GIRL, } console.log(SexType.BOY) // 0 console.log(SexType.GIRL) // 1
枚举编号会自动递增
enum SexType { BOY = 2, GIRL, } console.log(SexType.BOY) // 2 console.log(SexType.GIRL) // 3
枚举可以自定义
enum SexType { BOY = "男", GIRL = "女", } console.log(SexType.BOY) // 男 console.log(SexType.GIRL) // 女