App.vue 749 B

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