| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { createRouter, createWebHistory } from 'vue-router'
- import SystemConfig from '../views/SystemConfig.vue'
- const routes = [
- {
- path: '/',
- redirect: '/system-config'
- },
- {
- path: '/real-time-status',
- name: 'RealTimeStatus',
- component: () => import('../views/RealTimeStatus.vue'),
- meta: { title: '实时状态' }
- },
- {
- path: '/system-config',
- name: 'SystemConfig',
- component: SystemConfig,
- meta: { title: '系统配置' }
- },
- {
- path: '/network-config',
- name: 'NetworkConfig',
- component: () => import('../views/NetworkConfig.vue'),
- meta: { title: '网络配置' }
- },
- {
- path: '/led-debug',
- name: 'LedDebug',
- component: () => import('../views/LedDebug.vue'),
- meta: { title: 'LED调试' }
- },
- {
- path: '/about',
- name: 'About',
- component: () => import('../views/About.vue'),
- meta: { title: '关于' }
- }
- ]
- const router = createRouter({
- history: createWebHistory(),
- routes
- })
- // 路由守卫,设置页面标题
- router.beforeEach((to, from, next) => {
- if (to.meta.title) {
- document.title = `${to.meta.title} - 配线架配置`
- }
- next()
- })
- export default router
|