pub_svc_platform_screen/src/router/index.js

87 lines
2.0 KiB
JavaScript
Raw Normal View History

2025-09-09 10:52:30 +08:00
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
// 公共路由
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login'),
hidden: true
},
{
path: '/register',
component: () => import('@/views/register'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/error/404'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error/401'),
hidden: true
},
2025-09-09 15:15:00 +08:00
// 直接配置产品中心路由不使用Layout
2025-09-09 10:52:30 +08:00
{
2025-09-09 15:15:00 +08:00
path: '/product-center',
name: 'ProductCenter',
component: () => import('@/views/psp/productCenter/index'),
meta: { title: '产品中心首页' }
2025-09-09 10:52:30 +08:00
},
2025-09-09 15:15:00 +08:00
// 直接配置产品中心路由不使用Layout
2025-09-09 10:52:30 +08:00
{
2025-09-09 15:15:00 +08:00
path: '/product-case',
name: 'ProductCase',
component: () => import('@/views/psp/productCenter/product-case'),
meta: { title: '产品中心-案例' }
2025-09-09 10:52:30 +08:00
},
2025-09-09 15:15:00 +08:00
// 直接配置产品中心路由不使用Layout
2025-09-09 10:52:30 +08:00
{
2025-09-09 15:15:00 +08:00
path: '/product-detail',
name: 'ProductDetail',
component: () => import('@/views/psp/productCenter/product-detail'),
meta: { title: '产品中心-详情' }
2025-09-09 10:52:30 +08:00
},
{
2025-09-09 15:15:00 +08:00
path: '/common/index',
name: 'common',
component: () => import('@/views/psp/common/index'),
meta: { title: '产品中心' }
},
2025-09-09 10:52:30 +08:00
2025-09-09 15:15:00 +08:00
// 配置根路径重定向到产品中心
2025-09-09 10:52:30 +08:00
{
2025-09-09 15:15:00 +08:00
path: '/',
redirect: '/product-center',
hidden: true
2025-09-09 10:52:30 +08:00
}
]
2025-09-09 15:15:00 +08:00
// 可以移除dynamicRoutes动态路由部分
2025-09-09 10:52:30 +08:00
// 防止连续点击多次路由报错
let routerPush = Router.prototype.push
let routerReplace = Router.prototype.replace
// push
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(err => err)
}
// replace
Router.prototype.replace = function push(location) {
return routerReplace.call(this, location).catch(err => err)
}
export default new Router({
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})