App.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. console.log('App Launch')
  5. },
  6. onShow: function() {
  7. console.log('App Show')
  8. // this.autoUpdate();
  9. // if (uni.getStorageSync('userInfo')) uni.reLaunch({
  10. // url: '/pages/home/index'
  11. // })
  12. // else uni.reLaunch({
  13. // url: '/pages/login/index'
  14. // })
  15. },
  16. onHide: function() {
  17. console.log('App Hide')
  18. },
  19. methods: {
  20. autoUpdate() {
  21. if (wx.canIUse('getUpdateManager')) {
  22. const updateManager = wx.getUpdateManager();
  23. updateManager.onCheckForUpdate(res => {
  24. if (res.hasUpdate) {
  25. updateManager.onUpdateReady(() => {
  26. wx.showModal({
  27. title: '更新提示',
  28. content: '发现新版本,是否更新?',
  29. success: function(res) {
  30. if (res.confirm) {
  31. updateManager.applyUpdate();
  32. }
  33. }
  34. })
  35. });
  36. updateManager.onUpdateFailed(function() {
  37. wx.showModal({
  38. title: '最新版提示',
  39. content: '新版本已上线,请您删除当前小程序,重新搜索打开',
  40. showCancel: false
  41. })
  42. });
  43. }
  44. })
  45. } else {
  46. wx.showModal({
  47. title: '提示',
  48. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
  49. showCancel: false
  50. })
  51. }
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  58. @import "@/uni_modules/uview-ui/index.scss";
  59. .visibleItemCount {
  60. z-index: 99999999999 !important;
  61. }
  62. * {
  63. padding: 0;
  64. margin: 0;
  65. box-sizing: border-box;
  66. font-family: PingFangSC-Regular, PingFang SC;
  67. }
  68. html,
  69. body {
  70. font-family: PingFangSC-Regular, PingFang SC;
  71. font-size: 24rpx;
  72. width: 100%;
  73. height: 100%;
  74. }
  75. </style>