App.vue 881 B

123456789101112131415161718192021222324252627282930313233343536
  1. <script>
  2. import global from '@/mixins/global.js'
  3. export default {
  4. mixins: [global],
  5. onLaunch: function() {
  6. const updateManager = uni.getUpdateManager()
  7. updateManager.onCheckForUpdate(function(res) {
  8. console.log(res.hasUpdate)
  9. })
  10. updateManager.onUpdateReady(function(res) {
  11. uni.showModal({
  12. title: '更新提示',
  13. content: '新版本已经准备好,是否重启小程序?',
  14. success(res) {
  15. if (res.confirm) {
  16. updateManager.applyUpdate()
  17. }
  18. }
  19. })
  20. })
  21. this.$store.dispatch('app/initDevice')
  22. this.initSetSystemInfo() // 初始化系统程序
  23. }
  24. }
  25. </script>
  26. <style lang="scss">
  27. page {
  28. min-height: 100%;
  29. background: #f7f7f7;
  30. }
  31. </style>