main.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import App from './App'
  2. import store from './store/index'
  3. // #ifndef VUE3
  4. import Vue from 'vue'
  5. import './uni.promisify.adaptor'
  6. Vue.config.productionTip = false
  7. Vue.prototype.$store = store
  8. App.mpType = 'app'
  9. const app = new Vue({
  10. ...App,
  11. store,
  12. })
  13. app.$mount()
  14. // #endif
  15. uni.$u.config.unit = 'rpx'
  16. // 全局引入uView
  17. import uView from '@/uni_modules/uview-ui'
  18. import UniQrcode from 'uniapp-qrcode'
  19. Vue.use(uView)
  20. //重载uni.showToast,简化调用
  21. Vue.prototype.$showToast = function(title, duration = 2000, icon = "none") {
  22. return uni.showToast({
  23. title,
  24. duration,
  25. icon
  26. })
  27. }
  28. //全局apis
  29. import apis from './http/index.js'
  30. Vue.prototype.$api = apis;
  31. //日期格式处理
  32. import dateFormat from '@/utils/dateFormat.js'
  33. Vue.use(dateFormat);
  34. // 全局注册自定义头部组件
  35. import customNavBar from './components/uNavBar'
  36. Vue.component('c-nav-bar', customNavBar);
  37. // 全局注册空数据组件
  38. import NoData from './components/NoData'
  39. Vue.component('NoData', NoData);
  40. // 全局注册tabbar组件
  41. import Tabbar from './components/Tabbar'
  42. Vue.component('Tabbar', Tabbar);
  43. // 全局注册tabbar组件
  44. import Tabbares from './components/Tabbares'
  45. Vue.component('Tabbares', Tabbares);
  46. import customNavBar1 from './components/uNavBar1/index.vue'
  47. Vue.component('c-nav-bar1', customNavBar1);
  48. //全局分享当前页(带参数)
  49. import wxShare from '@/utils/wxShare.js'
  50. Vue.mixin(wxShare);
  51. //全局属性
  52. import getSystemInfo from '@/utils/getSystemInfo.js'
  53. Vue.mixin(getSystemInfo);
  54. //加解密和脱敏
  55. import aesTm from '@/utils/aes.js'
  56. Vue.prototype.$aesTm = aesTm;
  57. // #ifdef VUE3
  58. import {
  59. createSSRApp
  60. } from 'vue'
  61. export function createApp() {
  62. const app = createSSRApp(App)
  63. return {
  64. app
  65. }
  66. }
  67. // #endif