import { createRouter, createWebHashHistory } from 'vue-router'

const staticRouter = [
    {
        path: '/',
        name: '首页',
        redirect: 'home',
        children: [
            {
                path: '/home',
                name: 'home',
                component: () => import('@/views/home/Home.vue'),
                meta: {
                    title: '首页'
                },
            },
            {
                path: '/config',
                name: 'config',
                component: () => import('@/views/config.vue'),
                meta: {
                    title: '落煤筒配置'
                },
            },            
            {
                path: '/monitor',
                name: 'monitor',
                component: () => import('@/views/coalDrop/Monitor.vue'),
                meta: {
                    title: '落煤筒实时监控'
                },
            },
            {
                path: '/monitorHistory',
                name: 'monitorHistory',
                component: () => import('@/views/coalDrop/MonitorHistory.vue'),
                meta: {
                    title: '落煤筒历史监控'
                }
            },
            {
                path: '/bdVideo',
                name: 'bdVideo',
                component: () => import('@/views/detail/beltDeviation/Video.vue'),
                meta: {
                    title: '皮带表面跑偏实时视频'
                }
            },
            {
                path: '/bdVideoHistory',
                name: 'bdVideoHistory',
                component: () => import('@/views/detail/beltDeviation/VideoHistory.vue'),
                meta: {
                    title: '皮带表面跑偏历史视频'
                }
            },
            {
                path: '/ceo',
                name: 'ceo',
                component: () => import('@/views/detail/coalError/Oscillogram.vue'),
                meta: {
                    title: '实时波形图'
                }
            },
            {
                path: '/ceoh',
                name: 'ceoh',
                component: () => import('@/views/detail/coalError/OscillogramHistory.vue'),
                meta: {
                    title: '历史波形图'
                }
            },
            {
                path: '/beltSplit',
                name: 'beltSplit',
                component: () => import('@/views/belt/BeltSplit.vue'),
                meta: {
                    title: '皮带表面撕裂'
                }
            },
            {
                path: '/beltOffTrack',
                name: 'beltOffTrack',
                component: () => import('@/views/belt/OffTrack.vue'),
                meta: {
                    title: '皮带表面跑偏'
                }
            },
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: staticRouter
})

router.beforeEach((to, from) => {
    document.title = to.meta.title as string
})

export default router