kdofficial/src/startRouter.js
2025-05-20 19:05:41 +08:00

33 lines
675 B
JavaScript

import { createRouter, createWebHistory } from 'vue-router'
import HeaderVideo from './components/HeaderVideo.vue'
const routes = [
{
path: '/',
name: 'StartPage',
component: HeaderVideo,
meta: { title: 'KDESIGN - 欢迎' }
},
{
path: '/:pathMatch(.*)*',
redirect: to => {
window.location.href = `/index.html${to.fullPath}`
return '/'
}
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
router.beforeEach((to, from, next) => {
if (to.meta && to.meta.title) {
document.title = to.meta.title
}
next()
})
export default router