You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
705 B

import type { Component } from "vue"
import Vue from "vue"
import { FakeComponents } from "../src"
import Layout from "./layout.vue"
Vue.use(FakeComponents);
(async () => {
// @ts-expect-error 由于@somebuild/build-component-vue2没有导出vite的类型导致glob无法识别,暂时忽略
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()) as { default: Component }).default
const app = new Vue({
render: h => h(Layout, {}, [h(App)]),
})
app.$mount("#app")
})()