为什么我的this拿到的都是window方法

发布于 6 年前作者 qiang7610424 次浏览最后编辑 6 年前来自 ask

如图 我 console.log(this) 出来一直都是一个window

4 回复
jun18
jun181 楼6 年前

wxml部分

<input type=“text” password name=“password” placeholder=“输入原始密码” focus bindblur=“checkNull”/>

js 部分

checkNull: (e) => {

    const that = this

    e.detail.value && that.setData({

      disabled: false

    })

  },

jiangfang
jiangfang2 楼6 年前

好神奇……

zhaofang
zhaofang3 楼6 年前

checkNull 方法里输出 this 一直都是一个 window

guiyingduan
guiyingduan4 楼4 年前

你好,请贴上相关代码