初始化代码

This commit is contained in:
yiqiuyang
2025-09-03 18:05:48 +08:00
parent e5712b2e97
commit 4414fe517b
70 changed files with 2404 additions and 9 deletions

71
src/router/index.js Normal file
View File

@ -0,0 +1,71 @@
import {createWebHashHistory, createRouter} from 'vue-router'
import HomeView from '@/views/homepage/index.vue'
const routes = [
{path: '/', component: HomeView},
{
path: '/product',
component: () => import('@/views/product/index.vue'),
meta: {
title: '产品中心',
},
},
{
path: '/services',
component: () => import('@/views/services/index.vue'),
meta: {
title: '服务与支撑',
},
},
{
path: '/news',
component: () => import('@/views/news/index.vue'),
meta: {
title: '新闻中心',
},
},
{
path: '/news/detail',
name: 'Detail',
component: () => import('@/views/news/detail.vue'),
},
{
path: '/about',
component: () => import('@/views/about/index.vue'),
meta: {
title: '关于我们',
},
},
{
path: '/link',
component: () => import('@/views/link/index.vue'),
meta: {
title: '联系我们',
},
},
{
path: '/download',
component: () => import('@/views/download/index.vue'),
meta: {
title: '下载中心',
},
},
]
const router = createRouter({
history: createWebHashHistory(),
routes,
})
router.afterEach((to, from) => {
// 只有路径变化时才滚动到顶部
if (to.path !== from.path) {
requestAnimationFrame(() => {
window.scrollTo({top: 0, behavior: 'instant'})
})
}
})
export default router