main.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. import { getProfileImageUrl, imageUrl } from '@/utils/assetUrl.js'
  16. Vue.prototype.$api = api;
  17. Vue.prototype.$reg = regTest;
  18. Vue.prototype.$imageUrl = imageUrl;
  19. Vue.prototype.$profileImageUrl = getProfileImageUrl;
  20. Vue.prototype.$imgBase = imageUrl('');
  21. //微信支付
  22. import wxPay from '@/utils/wxPay.js'
  23. Vue.prototype.$wxPay = wxPay;
  24. //重载uni.showToast,简化调用
  25. Vue.prototype.$showToast = function(title, duration = 2000, icon = "none") {
  26. return uni.showToast({
  27. title,
  28. duration,
  29. icon
  30. })
  31. }
  32. //重载uni.showModal,简化调用
  33. Vue.prototype.$showModal = function(content) {
  34. return uni.showModal({
  35. title:'温馨提示',
  36. content,
  37. showCancel:false,
  38. confirmText: '确定',
  39. confirmColor: '#007A69'
  40. })
  41. }
  42. // 引入全局uView
  43. import uView from '@/uni_modules/uview-ui'
  44. Vue.use(uView)
  45. uni.$u.config.unit = 'rpx'
  46. const app = new Vue({
  47. ...App
  48. })
  49. app.$mount()
  50. // #endif
  51. // #ifdef VUE3
  52. import {
  53. createSSRApp
  54. } from 'vue'
  55. export function createApp() {
  56. const app = createSSRApp(App)
  57. return {
  58. app
  59. }
  60. }
  61. // #endif