App.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <script>
  2. export default {
  3. globalData: {
  4. fuid: 0,
  5. },
  6. onLaunch(data) {
  7. if (data && data.query && data.query.fuid) {
  8. this.globalData.fuid = data.query.fuid;
  9. }
  10. // #ifdef MP-WEIXIN
  11. const updateManager = wx.getUpdateManager();
  12. updateManager.onCheckForUpdate(function (res) {
  13. // 请求完新版本信息的回调
  14. console.log("请求完新版本信息的回调", res.hasUpdate);
  15. });
  16. updateManager.onUpdateReady(function () {
  17. wx.showModal({
  18. title: "更新提示",
  19. content: "新版本已经准备好,是否重启应用?",
  20. success: function (res) {
  21. if (res.confirm) {
  22. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  23. updateManager.applyUpdate();
  24. }
  25. },
  26. });
  27. });
  28. updateManager.onUpdateFailed(function () {
  29. console.log("新版本下载失败");
  30. });
  31. // #endif
  32. },
  33. onShow(data) {
  34. if (data && data.query && data.query.fuid) {
  35. this.globalData.fuid = data.query.fuid;
  36. }
  37. },
  38. onHide() {
  39. console.log("App Hide");
  40. },
  41. };
  42. </script>
  43. <style lang="scss">
  44. @import "@/assets/css/style.css";
  45. @import "@/assets/css/common.scss";
  46. </style>