在picker选择以后if判断失效
发布于 6 年前 作者 xiuying50 9593 次浏览 来自 问答

picker   绑定的事件

bindPickerChange: function(event) {

   this.setData({

     begin: this.data.beginArr[event.detail.value]

   })

 }

执行代码:

  console.log(this.data.begin);

   console.log(this.data.wage);

   if (this.data.begin >= this.data.wage) {

//这里输出的begin明明小于wage为什么会执行if

     console.log(this.data.begin);

     console.log(this.data.wage);

     this.setData({

       wagetax: 0,

       tax: 0,

       finalWage: this.data.wage

     })

     return;

   }

 

log打印的数据

1 回复

begin 和 wage 的类型确定是 Number 吗?是不是作为字符串比较了?

回到顶部