import { createSSRApp } from 'vue'
import './style.css'
import App from './App.vue'
import { store } from './store'
import { createSSRRouter } from './router'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import lazyPlugin from 'vue3-lazy'
// import { scrollToTop } from './assets/js/common.js'
// import { sync } from 'vuex-router-sync'
const router = createSSRRouter()
// 全局方法挂载

export function createApp() {
    const app = createSSRApp(App)
    // app.config.globalProperties.$scrollToTop = scrollToTop
    // sync(store,router)
    app.use(router)
    app.use(store)
    // for(const [key,component] of Object.entries(ElementPlusIconsVue)){
    //     app.component(key,component)
    // }
    app.use(ElementPlus)
    app.use(lazyPlugin, {
        loading: 'loading.gif',
        error: 'error.png',
    })
    return { app, router , store}
}
