quanyawei
2024-06-18 15fb2702039aae1a297b8f1584e24f228ae1994d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* eslint-disable @typescript-eslint/no-unused-vars */
import { createRouter, createWebHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'
 
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('../views/homePage.vue')
    },
    // 解决方案
    {
      path: '/solution',
      name: 'solution',
      component: () => import('../views/solution.vue')
    },
    // 产品中心
    {
      path: '/product',
      name: 'product',
      component: () => import('../views/product.vue'),
      children: [
        {
          path: 'productDetail',
          name: 'productDetail',
          component: () => import('../views/productDetail.vue')
        }
      ]
    },
    // 新闻中心
    {
      path: '/news',
      name: 'news',
      component: () => import('../views/news.vue')
    },
    // 关于我们
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/about.vue')
    },
    // 联系我们
    {
      path: '/contact',
      name: 'contact',
      component: () => import('../views/contact.vue')
    }
  ],
 
  // eslint-disable-next-line no-unused-vars
  scrollBehavior(to, from, savedPosition) {
    if (to.hash) {
      return {
        el: to.hash,
        behavior: 'smooth'
      }
    }
    return { top: 0 }
  }
})
 
export default router