You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.1 KiB
JavaScript

import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layout/index.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/editor', component: () => import('@/views/pageEditor/index.vue'),
},
// {
// path: '/test', component: () => import('@/views/page/index.vue'),
// },
{
path: '/',
component: Layout,
redirect: '/test',
children: [
{
path: 'test', component: () => import('@/views/page/index.vue'),
},
{
path: 'index', component: () => import('@/views/index/index.vue'),
},
{
path: 'productCenter', component: () => import('@/views/productCenter/index.vue'),
},
{
path: 'industrySolutions', component: () => import('@/views/industrySolutions/index.vue'),
},
{
path: 'productCenter/detail1', component: () => import('@/views/productCenter/detail2.vue'),
}, {
path: 'productCenter/detail2', component: () => import('@/views/productCenter/detail1.vue'),
},
{
path: 'index', component: () => import('@/views/index/index.vue'),
},
{
path: '/contactUs',
component: () => import('@/views/contactUs/index.vue'),
},
{
path: '/contactUs/MediaCenterDetail',
component: () => import('@/views/contactUs/MediaCenterDetail.vue'),
},
{
path: '/industryPlan/detail', component: () => import('@/views/productInfo.vue'),
},
]
// children: [
// {
// path: 'index',
// component: () => import('@/views/index/index.vue'),
// },
// {
// path: '/aboutHW',
// component: () => import('@/views/aboutHW.vue'),
// },
// {
// path: '/productCenter',
// component: () => import('@/views/productCenter.vue'),
// },
// {
// path: '/productCenter/detail',
// component: () => import('@/views/productInfo.vue'),
// },
// {
// path: '/industryPlan',
// component: () => import('@/views/industryPlan.vue'),
// },
// {
// path: '/serviceSupport',
// component: () => import('@/views/serviceSupport.vue'),
// },
// {
// path: '/newsCenter/details',
// component: () => import('@/views/newsCenter/details.vue'),
// },
// {
// path: '/contactUs',
// component: () => import('@/views/contactUs/index.vue'),
// },
// {
// path: 'casesAndClients/more',
// component: () => import('@/views/casesAndClients/IOT/more.vue'),
// },
// ]
},], scrollBehavior(to, from, savedPosition) {
if (to.hash) {
// 等 DOM 渲染完成再滚动
return new Promise((resolve) => {
setTimeout(() => {
const el = document.querySelector(to.hash);
if (el) {
el.scrollIntoView({behavior: 'smooth'});
}
resolve({left: 0, top: 0});
}, 200);
});
}
return {left: 0, top: 0};
}
})