main.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. Vue.config.productionTip = false
  5. App.mpType = 'app'
  6. import system from '@/utils/system.js'
  7. Vue.mixin(system);
  8. import CusHeader from '@/components/CusHeader'
  9. Vue.component('CusHeader',CusHeader);
  10. //日期格式处理
  11. import dateFormat from '@/utils/dateFormat.js'
  12. Vue.use(dateFormat);
  13. import regTest from './utils/reg.js'
  14. import api from '@/http/index.js'
  15. Vue.prototype.$api = api;
  16. Vue.prototype.$reg = regTest;
  17. //重载uni.showToast,简化调用
  18. Vue.prototype.$showToast = function(title, duration = 2000, icon = "none") {
  19. return uni.showToast({
  20. title,
  21. duration,
  22. icon
  23. })
  24. }
  25. //重载uni.showModal,简化调用
  26. Vue.prototype.$showModal = function(content) {
  27. return uni.showModal({
  28. title:'温馨提示',
  29. content,
  30. showCancel:false,
  31. confirmText: '确定',
  32. confirmColor: '#007A69'
  33. })
  34. }
  35. // 引入全局uView
  36. import uView from '@/uni_modules/uview-ui'
  37. Vue.use(uView)
  38. uni.$u.config.unit = 'rpx'
  39. const app = new Vue({
  40. ...App
  41. })
  42. app.$mount()
  43. // #endif
  44. // #ifdef VUE3
  45. import {
  46. createSSRApp
  47. } from 'vue'
  48. export function createApp() {
  49. const app = createSSRApp(App)
  50. return {
  51. app
  52. }
  53. }
  54. // #endif