feat(play): file doesn't exist jump to App (#5985)

* feat(play): file doesn't exist jump tp App

* chore: update
This commit is contained in:
btea 2022-02-11 10:32:03 -06:00 committed by GitHub
parent b825c07865
commit 3a4f2177ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,12 @@ import '@element-plus/theme-chalk/src/index.scss'
;(async () => {
const apps = import.meta.glob('./src/*.vue')
const name = location.pathname.replace(/^\//, '') || 'App'
const App = (await apps[`./src/${name}.vue`]()).default
const file = apps[`./src/${name}.vue`]
if (!file) {
location.pathname = 'App'
return
}
const App = (await file()).default
const app = createApp(App)
app.mount('#play')