JavaScript:switch-case语句中不区分大小写匹配

JavaScript中switch case语句大小写都可匹配:.toLowerCase()

toIntro(param) {
  switch (param.method.toLowerCase()) {
    case 'h5':
      this.$router.push({
        path: param.url,
      })
      break
    case 'outside':
      window.location.href = param.url
      break
    default:
      break
  }
},

猜你喜欢

转载自blog.csdn.net/yangwqi/article/details/112983515