feat: vite-ssg (#24)

This commit is contained in:
Anthony Fu authored and GitHub committed 2020-12-21 17:07:07 +08:00
1 parent d090ba51b4
commit 9978e5e5a1
9 files changed
+258 -1287

No files matched your search

+16 -7
View File
@@ -1,12 +1,21 @@
import './main.postcss'
import { createApp } from 'vue'
// import routes generated by Voie
import routes from 'voie-pages'
// progress bar
import NProgress from 'nprogress'
import { ViteSSG } from 'vite-ssg'
import installPlugins from './plugins'
import App from './App.vue'
const app = createApp(App)
export const createApp = ViteSSG(
App,
{ routes },
({ app, router, isClient }) => {
installPlugins(app)
installPlugins(app)
// true for hydrate
app.mount('#app', true)
if (isClient) {
router.beforeEach(() => { NProgress.start() })
router.afterEach(() => { NProgress.done() })
}
}
)