main.js 1.5 KB

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