mirror of
https://github.com/ProudMuBai/GoFilm.git
synced 2026-02-21 10:04:41 +08:00
init
This commit is contained in:
43
client/src/router/router.ts
Normal file
43
client/src/router/router.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
import {
|
||||
createRouter,
|
||||
createWebHistory,
|
||||
} from "vue-router";
|
||||
|
||||
|
||||
// 1.定义路由组件
|
||||
import IndexHome from "../views/IndexHome.vue";
|
||||
import Home from "../views/index/Home.vue";
|
||||
import FilmDetails from "../views/index/FilmDetails.vue";
|
||||
import Play from "../views/index/Play.vue";
|
||||
import SearchFilm from "../views/index/SearchFilm.vue";
|
||||
import CategoryFilm from "../views/index/CategoryFilm.vue";
|
||||
import NotFound from '../views/error/Error404.vue'
|
||||
|
||||
|
||||
// 2. 定义一个路由
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
component: IndexHome,
|
||||
redirect: '/index',
|
||||
children: [
|
||||
{path: 'index', component: Home},
|
||||
{path: 'filmDetail', component: FilmDetails},
|
||||
{path: 'play', component: Play},
|
||||
{path: 'search', component: SearchFilm},
|
||||
{path: 'CategoryFilm', component: CategoryFilm},
|
||||
]
|
||||
},
|
||||
{path: `/:pathMatch(.*)*`, component: NotFound},
|
||||
]
|
||||
|
||||
// 创建路由实例并传递 routes配置
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
|
||||
export {router}
|
||||
|
||||
Reference in New Issue
Block a user