wujianwei
8 小时以前 8b566e42dce1e29c3a43014838ad341a3f971070
ui/car_wx_app/App.vue
@@ -16,36 +16,40 @@
         console.log('App Hide')
      },
      methods:{
          updateApp() {
           const updateManager = uni.getUpdateManager();
           updateManager.onCheckForUpdate(function (res) {
             // 请求完新版本信息的回调
           });
         updateApp() {
            const updateManager = uni.getUpdateManager();
           updateManager.onUpdateReady(function (res) {
             uni.showModal({
               title: '更新提示',
               content: '新版本已经准备好,是否重启应用?',
            showCancel: false,
               success(res) {
                 if (res.confirm) {
                   // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
                   updateManager.applyUpdate();
                 } else if (res.cancel) {
                   console.log('用户点击取消,不更新');
                 }
               }
             });
            updateManager.onCheckForUpdate(function (res) {
               // 请求完新版本信息的回调
               console.log('检查更新结果:', res.hasUpdate);
               if (res.hasUpdate) {
                  console.log('发现新版本,正在下载...');
               } else {
                  console.log('当前已是最新版本');
               }
            });
           });
            updateManager.onUpdateReady(function (res) {
               uni.showModal({
                  title: '更新提示',
                  content: '新版本已经准备好,是否重启应用?',
                  success(res) {
                     if (res.confirm) {
                        // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
                        updateManager.applyUpdate();
                     }
                  }
               });
            });
           updateManager.onUpdateFailed(function (res) {
             // 新的版本下载失败
             uni.showModal({
               title: '已经有新版本了哟~',
               content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
             })
           });
            updateManager.onUpdateFailed(function (res) {
               // 新的版本下载失败
               uni.showModal({
                  title: '更新失败',
                  content: '新版本下载失败,请检查网络后重试',
                  showCancel: false
               });
            });
         }