vue 中选项卡切换?

在vue中,我用了个判断来进行选项卡切换,但是判断永远只能进前两个分支, 当this.totalHurt === 0时,进入page1, 当this.totalHurt等于其他任何值时,都进入page2。 this.totalHurt的值是int类型,结果也是对的,但是就是不能按照逻辑进入对应的page,大神帮忙看看啊,下面是代码:

    //  判断技能次数并跳转
        judgeSkillNum: function () {
          if (this.attackNumber === 3) {
            this.gamePage = false
            this.resultPage = true
            if(this.totalHurt === 0){       //  根据得分结果来跳转
              this.currentView = 'resultPage1'
            }else if(this.totalHurt < 901) {
              this.currentView = 'resultPage2'
            }else if(this.totalHurt < 1333) {
              this.currentView = 'resultPage3'
            }else{
              this.currentView = 'resultPage4'
            }
            console.log(this.currentView)     // 除了0,无论this.totalHurt为什么都进入了page2
            console.log(this.totalHurt)
          }else{
            return false
          }      

        },

clipboard.png

阅读 3.3k
1 个回答

下面打印出来的不是负的么

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题