小程序开放平台

文档中心
暂无目录

xhs.onUpdateReady

更新时间:2025-04-10 15:29:03

以Promise风格调用: 不支持

监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调

参数

function callback

参数



实例代码

App({
  onLaunch() {
    // 此处仅为效果展示,建议在app.js中的OnLaunch()中调用
    const updateManager = tt.getUpdateManager();
    updateManager.onUpdateFailed((err) => {
      console.log("版本更新失败原因", err);
      tt.showToast({
        title: "版本更新失败,请重试",
        icon: "none",
      });
    });
  },
});
该文档是否对您有帮助?