Files
super_video/src/router/index.ts
T

72 lines
1.4 KiB
TypeScript

import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'Home',
component: () => import('@/views/home/index.vue'),
meta: {
title: '首页'
}
},
{
path: '/guide',
name: 'Guide',
component: () => import('@/views/guide/index.vue'),
meta: {
title: '使用引导'
}
},
{
path: '/action',
name: 'Action',
component: () => import('@/views/home/action.vue'),
meta: {
title: '开始拍摄'
}
},
// vlog 发现与记录
{
path: '/vlog',
name: 'Vlog',
component: () => import('@/views/vlog/index.vue'),
meta: {
title: '发现与记录'
}
},
// vlog 发现与记录
{
path: '/work',
name: 'Work',
component: () => import('@/views/vlog/work/index.vue'),
meta: {
title: '发现与记录'
}
},
{
path: '/prepare',
name: 'Prepare',
component: () => import('@/views/prepare/index.vue'),
meta: {
title: '脚本准备'
}
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
// 路由守卫
router.beforeEach((to, _from, next) => {
// 设置页面标题
if (to.meta?.title) {
document.title = `${to.meta.title} - 短视频达人`
}
next()
})
export default router