main.js 949 B

1234567891011121314151617181920212223242526272829303132
  1. import { createSSRApp } from 'vue'
  2. import App from './App.vue'
  3. import * as filters from './utils/filters.js'
  4. import store from './store'
  5. // import uView from 'uview-ui'
  6. import config from '@/config/config'
  7. export function createApp() {
  8. const app = createSSRApp(App)
  9. // 全局注册 filters(通过 globalProperties.$filters)
  10. app.config.globalProperties.$filters = {}
  11. Object.keys(filters).forEach((key) => {
  12. app.config.globalProperties.$filters[key] = filters[key]
  13. })
  14. // 全局配置颜色变量(替代 Vue.prototype)
  15. app.config.globalProperties.$mainColor = config.mainColor
  16. app.config.globalProperties.$lightColor = config.lightColor
  17. app.config.globalProperties.$aiderLightColor = config.aiderLightColor
  18. // 使用 Vuex store
  19. app.use(store)
  20. // 使用 uView UI 框架(确保已正确安装并配置)
  21. // app.use(uView)
  22. // SSR 挂载由框架控制,这里仅返回 app 实例
  23. return {
  24. app
  25. }
  26. }