// main.js(Vue 3)
import { createSSRApp } from 'vue'
import App from './App.vue'
import * as filters from './utils/filters.js'
import store from './store'
import uviewPlus from 'uview-plus'

export function createApp() {
  const app = createSSRApp(App)
  
  // 使用 uview-plus
  app.use(uviewPlus)
  
  // 使用 Vuex store
  app.use(store)
  
  // 迁移全局过滤器为全局方法
  // Vue3 移除了过滤器功能，改为全局方法
  Object.keys(filters).forEach((key) => {
    app.config.globalProperties['$' + key] = filters[key]
  })
  
  return {
    app
  }
}
