main.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. //全局分享当前页(带参数)
  47. import wxShare from '@/utils/wxShare.js'
  48. Vue.mixin(wxShare);
  49. //全局属性
  50. import getSystemInfo from '@/utils/getSystemInfo.js'
  51. Vue.mixin(getSystemInfo);
  52. // #ifdef VUE3
  53. import {
  54. createSSRApp
  55. } from 'vue'
  56. export function createApp() {
  57. const app = createSSRApp(App)
  58. return {
  59. app
  60. }
  61. }
  62. // #endif