async在事件函数中的问题
发布于 6 年前 作者 qiang76 344 次浏览 来自 问答

async在input输入第二次的时候直接打印出 [object Promise] 55,这该怎么解决

<input type="number" placeholder-class="gd1" bindinput="inputverifycode" class="f17" placeholder="输入验证码" value="{{code}}"/>
inputverifycode:async function(e){
        console.log(e.detail.value,55)
        var that = this;
        this.setData({
            verifycode: e.detail.value
        })
        if (e.detail.value.length == 6) {
             
            var data = {
                "code": e.detail.value,
                "phone": this.data.phone
            }
            //app.outTime(that);
          const result = await request({url:'phonecode/validateCode', data, method:'POST'})
          console.log(result,43);
        }
 
    },
3 回复

用then 解决了

单独输出input会这样吗?

同遇到这个问题,楼主解决了吗?

回到顶部