kdofficial/src/router.js
2025-05-04 17:36:25 +08:00

62 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
const routes= [
{
path: '/',
name: 'Homepage',
component: ()=>import('./components/Homepage.vue'),
meta: { title: '首页-开动文化科技(北京)有限公司' }
},
{
path: '/ContactUs',
name: 'ContactUs',
component: ()=>import('./components/ContactUs.vue'),
meta: { title: '联系我们-开动文化科技(北京)有限公司' }
},
{
path: '/Aboutus',
name: 'Aboutus',
component: ()=>import('./components/Aboutus.vue'),
meta: { title: '关于我们-开动文化科技(北京)有限公司' }
},
{
path: '/ServiceProcess',
name: 'ServiceProcess',
component: ()=>import('./components/ServiceProcess.vue'),
meta: { title: '服务流程-开动文化科技(北京)有限公司' }
},
{
path: '/Examples',
name: 'Examples',
component: ()=>import('./components/Examples.vue'),
meta: { title: '行业案例-开动文化科技(北京)有限公司' }
},
{
path: '/Err404',
name: 'Err404',
component: ()=>import('./components/Tools/Err404.vue'),
meta: { title: '404未找到此页面' }
},
{
path: '/:pathMatch(.*)*',
redirect: '/Err404'
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
// 路由守卫,切换页面时修改标题
router.beforeEach((to, from, next) => {
if (to.meta && to.meta.title) {
document.title = to.meta.title
} else {
document.title = '开动文化科技(北京)有限公司'
}
next()
})
export default router