You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

  1. <script>
  2. import { useDeviceStore } from './stores/modules/deviceInfo'
  3. export default {
  4. onLaunch: function() {
  5. console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
  6. console.log('App Launch')
  7. // 初始化设备信息,避免请求拦截器读取为空
  8. // const deviceStore = useDeviceStore()
  9. // try {
  10. // const sys = uni.getSystemInfoSync()
  11. // let deviceId = ''
  12. // // #ifdef APP-PLUS
  13. // try { deviceId = plus?.device?.uuid || '' } catch(e) {}
  14. // // #endif
  15. // if (!deviceId) deviceId = uni.getStorageSync('device_id')
  16. // if (!deviceId) {
  17. // deviceId = `web_${Date.now()}_${Math.random().toString(36).slice(2,10)}`
  18. // uni.setStorageSync('device_id', deviceId)
  19. // }
  20. // deviceStore.setDeviceInfo({ deviceId, platform: sys.platform, model: sys.model })
  21. // console.log('Device init:', deviceStore.deviceInfo)
  22. // } catch(e) { console.warn('Init device info failed:', e) }
  23. },
  24. onShow: function() {
  25. console.log('App Show')
  26. },
  27. onHide: function() {
  28. console.log('App Hide')
  29. }
  30. }
  31. </script>
  32. <style lang="scss">
  33. /*每个页面公共css */
  34. @import '@/uni_modules/uni-scss/index.scss';
  35. /* #ifndef APP-NVUE */
  36. @import '@/static/customicons.css';
  37. // 设置整个项目的背景色
  38. page {
  39. background-color: #f5f5f5;
  40. }
  41. /* #endif */
  42. .example-info {
  43. font-size: 14px;
  44. color: #333;
  45. padding: 10px;
  46. }
  47. </style>