|
@@ -2,12 +2,21 @@ import { createApp } from 'vue'
|
|
|
import App from './App.vue'
|
|
import App from './App.vue'
|
|
|
import { createPinia } from 'pinia'
|
|
import { createPinia } from 'pinia'
|
|
|
import naive from './assets/js/nativeUiPluginPublic'
|
|
import naive from './assets/js/nativeUiPluginPublic'
|
|
|
-import router from './router'
|
|
|
|
|
|
|
+import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
|
|
|
import '@/utils/rem'
|
|
import '@/utils/rem'
|
|
|
|
|
+// 动态路由
|
|
|
|
|
+const routes = Object.values(import.meta.glob('./views/*/route.ts', { eager: true })).map((m) => (m as any).default || m)
|
|
|
|
|
+console.log(routes)
|
|
|
|
|
+
|
|
|
const store = createPinia()
|
|
const store = createPinia()
|
|
|
const app = createApp(App)
|
|
const app = createApp(App)
|
|
|
|
|
+const router = createRouter({
|
|
|
|
|
+ history: createWebHashHistory(),
|
|
|
|
|
+ routes
|
|
|
|
|
+})
|
|
|
|
|
+// 路由守卫
|
|
|
|
|
|
|
|
app.use(store)
|
|
app.use(store)
|
|
|
- .use(router)
|
|
|
|
|
.use(naive)
|
|
.use(naive)
|
|
|
|
|
+ .use(router)
|
|
|
.mount('#app')
|
|
.mount('#app')
|