Files
hi-landing-hero/src/router/index.ts
T
sepakeloudest 784cabaddc
site-dist-deploy / build-and-deploy (push) Successful in 2m9s
增加评论样式
2026-03-23 12:09:21 +02:00

58 lines
1.3 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: () => import('../pages/Home/index.vue'),
},
{
path: '/reviews',
name: 'reviews',
component: () => import('../pages/Reviews/index.vue'),
},
{
path: '/help',
name: 'help',
component: () => import('../pages/Help/index.vue'),
},
{
path: '/user-center',
name: 'user-center',
component: () => import('../pages/UserCenter/index.vue'),
},
{
path: '/terms',
name: 'terms-of-service',
component: () => import('../pages/TermsOfService/index.vue'),
},
{
path: '/privacy',
name: 'privacy-policy',
component: () => import('../pages/PrivacyPolicy/index.vue'),
},
{
path: '/login',
name: 'login-redirect',
component: () => import('../pages/LoginRedirect/index.vue'),
},
{
path: '/:pathMatch(.*)*',
name: 'not-found',
redirect: '/',
},
],
})
router.beforeEach((to, _from, next) => {
if (to.path === '/user-center' && !localStorage.getItem('Authorization')) {
next({ path: '/', query: { login: 'true' } })
} else {
next()
}
})
export default router