回调函数嵌套用时出现问题?
发布于 5 年前 作者 huxiuying 10981 次浏览 来自 官方Issues

   const self = this;

   self.countdaynum(str, function () {

        console.log(self.data.appX)

     //以下回调函数单独用正确,嵌套在上一回调函中就出现问题????

     const that = this;

     that.counttimenum(str, function () {

        console.log(that.data.appY)

   })

 })

1 回复

多余的步骤,没有理解 this作用域,用self就行了

回到顶部