在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
枚举EnumEnum是一种数据类型,由一组命名的值组成,名称通常是作为常量的标识符 enum Direction { Up, Down, Left, Right } let go: Direction; go = Direction.Up; 实战export enum themeMode { light = "light", dark = "dark" } export enum levelIndex { lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7, lv8, lv9, lv10, lv11, lv12, lv13, lv14, lv15, } import { globel_indexpage, levelIndex, themeMode } from "@/store/game-vip-level"; async isDarkStyle() { await isDarkMode().then((res) => { this.themeMode = res ? themeMode.dark : themeMode.light; }); } getLevelIndex(num: number): levelIndex { let level = levelIndex.lv15; switch (num) { case 0: level = levelIndex.lv0; break; case 1: level = levelIndex.lv1; break; case 2: level = levelIndex.lv2; break; case 3: level = levelIndex.lv3; break; case 4: level = levelIndex.lv4; break; case 5: level = levelIndex.lv5; break; case 6: level = levelIndex.lv6; break; case 7: level = levelIndex.lv7; break; case 8: level = levelIndex.lv8; break; case 9: level = levelIndex.lv9; break; case 10: level = levelIndex.lv10; break; case 11: level = levelIndex.lv11; break; case 12: level = levelIndex.lv12; break; case 13: level = levelIndex.lv13; break; case 14: level = levelIndex.lv14; break; case 15: level = levelIndex.lv15; break; } return level; } 参考
|
请发表评论