main.js 577 B

1234567891011121314151617181920212223242526
  1. // main.js(Vue 3)
  2. import { createSSRApp } from 'vue'
  3. import App from './App.vue'
  4. import * as filters from './utils/filters.js'
  5. import store from './store'
  6. import uviewPlus from 'uview-plus'
  7. export function createApp() {
  8. const app = createSSRApp(App)
  9. // 使用 uview-plus
  10. app.use(uviewPlus)
  11. // 使用 Vuex store
  12. app.use(store)
  13. // 迁移全局过滤器为全局方法
  14. // Vue3 移除了过滤器功能,改为全局方法
  15. Object.keys(filters).forEach((key) => {
  16. app.config.globalProperties['$' + key] = filters[key]
  17. })
  18. return {
  19. app
  20. }
  21. }