element-plus/play/main.ts
btea 3a4f2177ba
feat(play): file doesn't exist jump to App (#5985)
* feat(play): file doesn't exist jump tp App

* chore: update
2022-02-12 00:32:03 +08:00

16 lines
400 B
TypeScript

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