ifelse 简化
作者:互联网
let map = {
100: "医生",
200: "护士",
300: "其他"
};
this.workerType = map[this.$route.query.workerType];
if (this.$route.query.workerType == 100) {
this.workerType = "医生";
} else if (this.$route.query.workerType == 200) {
this.workerType = "护士";
} else if (this.$route.query.workerType == 300) {
this.workerType = "其他";
} else {
this.workerType = this.$route.query.workerType;
}
标签:workerType,map,200,route,else,简化,query,ifelse 来源: https://www.cnblogs.com/ylblogs/p/12661844.html