页面能不能修改app.js 里的函数的this指向?为什么我修改不了?新人求指教!
发布于 6 年前 作者 na39 5158 次浏览 来自 官方Issues

基础库 2.12.2

/* index.js */

onShow: function () {

    //启动通知监听

    app.watchMessage.call(this); // 修改this指向

...

  },

/* app.js */

async watchMessage() {

    //var that = this

    console.log(this); //打印出来的this还是app

    …

}

回到顶部