You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.4 KiB
106 lines
2.4 KiB
import { createWebHashHistory, createRouter, RouteRecordRaw } from 'vue-router'
|
|
const Parent = () => import('@/view/layout/parent.vue')
|
|
const routes: Array<RouteRecordRaw> = [
|
|
{
|
|
path: '/',
|
|
name: 'layout',
|
|
component: () => import('@/view/layout/index.vue'),
|
|
children: [],
|
|
redirect: () => {
|
|
return { path: '/layout/policy' }
|
|
},
|
|
},
|
|
{
|
|
path: '/layout',
|
|
component: () => import('@/view/layout/index.vue'),
|
|
children: [
|
|
{
|
|
path: 'Policy',
|
|
component: () => import('@/view/policy/index.vue'),
|
|
meta: { title: 'policy' },
|
|
},
|
|
{
|
|
path: 'home2',
|
|
component: () => import('@/view/home/index.vue'),
|
|
meta: { title: 'home' },
|
|
},
|
|
{
|
|
path: 'about3',
|
|
component: () => import('@/view/about/index.vue'),
|
|
meta: { title: 'about' },
|
|
},
|
|
{
|
|
path: 'Showings',
|
|
component: () => import('@/view/showings/index.vue'),
|
|
meta: { title: 'showings' },
|
|
},
|
|
{
|
|
path: 'contact',
|
|
component: () => import('@/view/contact/index.vue'),
|
|
meta: { title: 'contact' },
|
|
},
|
|
{
|
|
path: 'latestArticle',
|
|
component: () => import('@/view/latestArticle/index.vue'),
|
|
meta: { title: 'latestArticle' },
|
|
},
|
|
{
|
|
path: 'articleDetail',
|
|
component: () => import('@/view/latestArticle/detail.vue'),
|
|
meta: { title: 'latestArticleDetail' },
|
|
}
|
|
],
|
|
},
|
|
{
|
|
path: '/login',
|
|
component: () => import('@/view/layout/login.vue'),
|
|
meta: { title: 'login', auth: false },
|
|
},
|
|
//页面中的二级页面
|
|
{
|
|
path: '/user',
|
|
name: 'userPage',
|
|
component: Parent,
|
|
children: [
|
|
{
|
|
path: 'detail',
|
|
name: 'detail',
|
|
component: () => import('@/view/user/detail.vue'),
|
|
meta: {
|
|
title: '用户二级页面',
|
|
pass: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
|
|
{
|
|
path: '/404',
|
|
name: 'NotFound',
|
|
component: () => import('@/view/layout/404.vue'),
|
|
meta: {
|
|
title: '404',
|
|
auth: false,
|
|
},
|
|
},
|
|
{
|
|
//不存在的路由
|
|
path: '/:pathMatch(.*)',
|
|
redirect: '/404',
|
|
},
|
|
]
|
|
|
|
const router = createRouter({
|
|
history: createWebHashHistory(),
|
|
routes,
|
|
scrollBehavior(to) {
|
|
if (to.hash) {
|
|
return {
|
|
el: to.hash,
|
|
behavior: 'smooth',
|
|
}
|
|
}
|
|
},
|
|
})
|
|
|
|
export default router
|
|
|