main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import Vue from 'vue'
  2. import App from './App'
  3. Vue.config.productionTip = false
  4. import uView from 'uview-ui'
  5. Vue.use(uView)
  6. // uni.$u.config.unit = 'rpx'
  7. import store from './store/index.js' // 确保路径正确
  8. Vue.prototype.$store = store;
  9. import {formatSeconds}from './utils/tools.js'
  10. Vue.prototype.$formatSeconds = formatSeconds;
  11. import {isLoginCourseAuto}from './utils/courseTool.js'
  12. Vue.prototype.$isLoginCourseAuto = isLoginCourseAuto;
  13. import utils from './utils/common.js'
  14. Vue.prototype.utils = utils;
  15. import {
  16. setData,
  17. isLoginCourse
  18. } from './utils/common.js'
  19. // vuex
  20. Vue.prototype.$isLoginCourse = isLoginCourse
  21. Vue.prototype.setData = setData;
  22. App.mpType = 'app'
  23. const app = new Vue({
  24. ...App,
  25. store
  26. })
  27. app.$mount()
  28. // #ifdef VUE3
  29. import { createSSRApp } from 'vue'
  30. export function createApp() {
  31. const app = createSSRApp(App)
  32. app.use(uviewPlus)
  33. app.config.globalProperties.$isLogin = isLogin
  34. app.config.globalProperties.$isEmpty = isEmpty
  35. app.config.globalProperties.$parsePhone = parsePhone
  36. app.config.globalProperties.$showLoginPage = showLoginPage
  37. app.config.globalProperties.$getRegistrationID = getRegistrationID
  38. app.config.globalProperties.$navBack = navBack
  39. app.config.globalProperties.$navTo = navTo
  40. app.config.globalProperties.$qconfig = qconfig
  41. app.config.globalProperties.$getAge = getAge
  42. app.config.globalProperties.$parseIdCard = parseIdCard
  43. app.config.globalProperties.$getDictLabelName = getDictLabelName
  44. app.config.globalProperties.$parseText = parseText
  45. app.config.globalProperties.$logout = logout,
  46. app.config.globalProperties.$getUserInfo = getUserInfo,
  47. app.config.globalProperties.$dateFormatStr = dateFormatStr,
  48. app.config.globalProperties.$registerIdCode = registerIdCode,
  49. app.config.globalProperties.$formatSeconds = formatSeconds,
  50. app.config.globalProperties.$formatDate = formatDate,
  51. app.config.globalProperties.$parseIDCardInfo = parseIDCardInfo
  52. app.config.globalProperties.$timeFormat = timeFormat;
  53. app.config.globalProperties.$formatHour = formatHour;
  54. return {
  55. app
  56. }
  57. }
  58. // #endif