this.duration = index == 0 ? 1000 : index == 1 ? 2000 : 3000;
等同于下面的
if (index == 0) {
this.duration = 1000;
} else {
if (index == 1) {
this.duration = 2000;
} else {
this.duration = 3000;
}
}
以上纯属个人理解,如有不懂欢迎评论区留言哦
this.duration = index == 0 ? 1000 : index == 1 ? 2000 : 3000;
等同于下面的
if (index == 0) {
this.duration = 1000;
} else {
if (index == 1) {
this.duration = 2000;
} else {
this.duration = 3000;
}
}
以上纯属个人理解,如有不懂欢迎评论区留言哦