enum BlockPrefab{
BLOCK2 = 0,
BLOCK4,
BLOCK8,
BLOCK16,
BLOCK32,
BLOCK64,
BLOCK128,
BLOCK256,
BLOCK512,
BLOCK1024,
BLOCK2048
}
let num = BlockPrefab.BLOCK128;
let smth = BlockPrefab[num];
let xx = BlockPrefab[smth];
ts 的enum编译为js如图所示
BlockPrefab["BLOCK2"] = 0 可以相互转化 以此来实现enum
标签:TypeScript,num,enum,BlockPrefab,遍历,let,smth From: https://www.cnblogs.com/kekit-rei/p/17571342.html