main.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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({ title, duration, icon })
  23. }
  24. //全局apis
  25. import apis from './http/index.js'
  26. Vue.prototype.$api = apis;
  27. //日期格式处理
  28. import dateFormat from '@/utils/dateFormat.js'
  29. Vue.use(dateFormat);
  30. // 全局注册自定义头部组件
  31. import customNavBar from './components/uNavBar'
  32. Vue.component('c-nav-bar', customNavBar);
  33. // 全局注册空数据组件
  34. import NoData from './components/NoData'
  35. Vue.component('NoData', NoData);
  36. // 全局注册tabbar组件
  37. import Tabbar from './components/Tabbar'
  38. Vue.component('Tabbar', Tabbar);
  39. //全局分享当前页(带参数)
  40. import wxShare from '@/utils/wxShare.js'
  41. Vue.mixin(wxShare);
  42. //全局属性
  43. import getSystemInfo from '@/utils/getSystemInfo.js'
  44. Vue.mixin(getSystemInfo);
  45. // #ifdef VUE3
  46. import {
  47. createSSRApp
  48. } from 'vue'
  49. export function createApp() {
  50. const app = createSSRApp(App)
  51. return {
  52. app
  53. }
  54. }
  55. // #endif