diff --git a/src/router/index.ts b/src/router/index.ts index a4c1779..4bc1f6f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,58 +1,77 @@ -// 第一步,引入createRouter -import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router' +import { createRouter, createWebHashHistory } from 'vue-router' import Layout from '@/components/Layout.vue'; import AlertChart from '@/components/AlertChart.vue'; import Statistics from '@/components/Statistics.vue'; import AlertManagement from '@/html/AlertManagement.vue'; import Test from '@/html/Test.vue'; -// import Login from '@/html/LoginView.vue'; - +import Login from '@/html/LoginView.vue'; +import UserList from '@/html/UserList.vue'; +import Home from '@/html/Home.vue'; +import DataStatistics from '@/html/DataStatistics.vue'; const routes = [ { path: '/', name: 'Layout', component: Layout, + meta: { requiresAuth: true }, children: [ { path: '', + name: 'Home', + component: Home, + meta: { requiresAuth: true } + }, + { + path: '/alertManagement', name: 'AlertManagement', component: AlertManagement, + meta: { requiresAuth: true } }, { path: '/test', name: 'Test', component: Test, + meta: { requiresAuth: true } }, { path: '/alertChart', name: 'AlertChart', component: AlertChart, + meta: { requiresAuth: true } }, { path: '/statistics', name: 'Statistics', component: Statistics, + meta: { requiresAuth: true } + }, + { + path:'/userList', + name: 'UserList', + component: UserList, + meta: { requiresAuth: true } + }, + { + path:'/dataStatistics', + name: 'DataStatistics', + component: DataStatistics, + meta: { requiresAuth: true } } ] - + }, + { + path: '/login', + name: 'Login', + component: Login, + meta: { requiresAuth: false } } - // , - // { - // path: '/login', - // name: 'Login', - // component: Login, - // meta: { requiresAuth: false } - // }, - -] - +]; const router = createRouter({ history: createWebHashHistory(), routes -}) +}); - -export default router; \ No newline at end of file +export default router;