main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. import './uni.promisify.adaptor'
  5. Vue.config.productionTip = false
  6. App.mpType = 'app'
  7. const app = new Vue({
  8. ...App
  9. })
  10. app.$mount()
  11. import uView from 'uview-ui';
  12. Vue.use(uView);
  13. uni.$u.config.unit = 'rpx';
  14. //简化提示
  15. Vue.prototype.$showToast = function(title, duration = 2000, icon = "none") {
  16. return uni.showToast({ title, duration, icon });
  17. }
  18. //挂载api
  19. import apis from '@/apis/index.js';
  20. Vue.prototype.$api = apis;
  21. //日期格式处理
  22. import dateFormat from '@/utils/dateFormat.js';
  23. Vue.use(dateFormat);
  24. //引入校验库
  25. import reg from '@/utils/htc.js'
  26. Vue.prototype.$reg = reg;
  27. //全局属性
  28. import pageCommon from '@/mixins/common.js'
  29. Vue.mixin(pageCommon);
  30. //全局注册组件
  31. import uHeader from '@/components/common/uHeader'
  32. Vue.component('uHeader',uHeader);
  33. import cusEcharts from '@/components/cusEcharts/index'
  34. Vue.component('cusEcharts',cusEcharts);
  35. //tabbar
  36. import tabbar from '@/components/Tabbar/tabbar'
  37. Vue.component('tabbar',tabbar);
  38. // #endif
  39. // #ifdef VUE3
  40. import { createSSRApp } from 'vue'
  41. export function createApp() {
  42. const app = createSSRApp(App)
  43. return {
  44. app
  45. }
  46. }
  47. // #endif