App.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. console.log('App Launch');
  5. // #ifdef APP-NVUE
  6. plus.screen.lockOrientation('portrait-primary');
  7. let appid = plus.runtime.appid;
  8. if (appid && appid.toLocaleLowerCase() != "hbuilder") {
  9. uni.request({
  10. url: 'https://uniapp.dcloud.io/update', //检查更新的服务器地址
  11. data: {
  12. appid: plus.runtime.appid,
  13. version: plus.runtime.version
  14. },
  15. success: (res) => {
  16. console.log('success', res);
  17. if (res.statusCode == 200 && res.data.isUpdate) {
  18. let openUrl = plus.os.name === 'iOS' ? res.data.iOS : res.data.Android;
  19. // 提醒用户更新
  20. uni.showModal({
  21. title: '更新提示',
  22. content: res.data.note ? res.data.note : '是否选择更新',
  23. success: (showResult) => {
  24. if (showResult.confirm) {
  25. plus.runtime.openURL(openUrl);
  26. }
  27. }
  28. })
  29. }
  30. }
  31. })
  32. }
  33. var domModule = weex.requireModule('dom');
  34. domModule.addRule('fontFace', {
  35. 'fontFamily': "texticons",
  36. 'src': "url('./static/text-icon.ttf')"
  37. });
  38. // #endif
  39. },
  40. onShow: function() {
  41. console.log('App Show')
  42. },
  43. onHide: function() {
  44. console.log('App Hide')
  45. }
  46. }
  47. </script>
  48. <style lang="less">
  49. /*每个页面公共css */
  50. .u-tabbar--fixed {
  51. padding: 19rpx 0;
  52. }
  53. .u-tabbar__content__item-wrapper {
  54. height: auto !important;
  55. // padding: 10rpx 0;
  56. }
  57. .u-tabbar-item__text {
  58. font-size: 32rpx;
  59. padding: 12rpx 0;
  60. }
  61. </style>