uniapp小程序微信登录 (uniapp小程序开发和微信小程序)

文件App.vue

    onLaunch() {
      // 小程序主动更新
      this.updateManager()
    },

    methods: {

      /**
       * 小程序主动更新
       */
      updateManager() {
        const updateManager = uni.getUpdateManager();
        updateManager.onCheckForUpdate(res => {
          // 请求完新版本信息的回调
          // console.log(res.hasUpdate)
        })
        updateManager.onUpdateReady(() => {
          uni.showModal({
            title: '更新提示',
            content: '新版本已经准备好,即将重启应用',
            showCancel: false,
            success(res) {
              if (res.confirm) {
                // 新的版本已经*载下**好,调用 applyUpdate 应用新版本并重启
                updateManager.applyUpdate()
              }
            }
          })
        })
        updateManager.onUpdateFailed(() => {
          // 新的版本*载下**失败
          uni.showModal({
            title: '更新提示',
            content: '新版本*载下**失败',
            showCancel: false
          })
        })
      }

    }