
这段ts代码函数,不管传入的nindex是1还是2,switch判断都会走到default,但是上面的if判断却没问题,求解怎么回事啊。
default里面输出的nIndex也是正确的1或者2.
default里用if判断也是对的

这段ts代码函数,不管传入的nindex是1还是2,switch判断都会走到default,但是上面的if判断却没问题,求解怎么回事啊。
default里面输出的nIndex也是正确的1或者2.
default里用if判断也是对的
你把nIndex == 1换成nIndex === 1再看看···
问题找到了,一个对象定义有问题,不能用Integer,要写default:0,不然被当作对象传过来了