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
  }
},

 

你可能感兴趣的:(JavaScript)