爱山东pc端
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.

107 lines
2.4 KiB

3 months ago
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: () => {
3 months ago
return { path: '/layout/policy' }
3 months ago
},
},
{
path: '/layout',
component: () => import('@/view/layout/index.vue'),
children: [
{
path: 'Policy',
component: () => import('@/view/policy/index.vue'),
meta: { title: 'policy' },
3 months ago
},
{
3 months ago
path: 'home2',
component: () => import('@/view/home/index.vue'),
meta: { title: 'home' },
},
{
path: 'about3',
3 months ago
component: () => import('@/view/about/index.vue'),
meta: { title: 'about' },
},
{
2 months ago
path: 'Showings',
component: () => import('@/view/showings/index.vue'),
meta: { title: 'showings' },
3 months ago
},
{
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' },
3 months ago
}
3 months ago
],
},
{
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