突报:Cannot read property 'bind' of undefined 【急急急】
发布于 6 年前 作者 juan85 13240 次浏览 来自 问答

使用中的小程序,突然报 Cannot read property ‘bind’ of undefined,导至客户全部无法使用,经检查是检查升级那里报的:

  if (wx.canIUse(“getUpdateManager”)) {

      let updateManager = wx.getUpdateManager();

      updateManager.onCheckForUpdate((res) => {

        // 请求完新版本信息的回调

        console.log(res.hasUpdate);

      })

      updateManager.onUpdateReady(() => {

        wx.showModal({

          title: ‘更新提示’,

          content: ‘新版本已经准备好,是否重启应用?’,

          success: (res) => {

            if (res.confirm) {

              // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启

              updateManager.applyUpdate();

            } else if (res.cancel) {

              return false;

            }

          }

        })

      })

      console.log(‘onUpdateReady’, updateManager.onUpdateReady());

      console.log(‘onUpdateFailed’, updateManager.onUpdateFailed());

      updateManager.onUpdateFailed(() => {

        // 新的版本下载失败

        wx.hideLoading();

        wx.showModal({

          title: ‘升级失败’,

          content: ‘新版本下载失败,请检查网络!’,

          showCancel: false

        });

      });

    }

3 回复

应该恢复了,你们一会试下

你好,请提供appid、出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部