https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route
Dynamic Route Matching with Params | Vue Router
Dynamic Route Matching with Params Very often we will need to map routes with the given pattern to the same component. For example we may have a User component which should be rendered for all users but with different user IDs. In Vue Router we can use a d
router.vuejs.org
index.js
import { createRouter, createWebHashHistory } from 'vue-router'
import Home from './Home'
import Movie from './Movie'
import About from './About'
import NotFound from './NotFound'
export default createRouter({
// Hash, History
// https://google.com/#/search
history: createWebHashHistory(),
// pages
routes: [
{
path: '/',
component: Home
},
{
path: '/movie/:id',
component: Movie
},
{
path: '/about',
component: About
},
{
path: '/:notFound(.*)',
component: NotFound
}
]
})
NotFound.vue
<template>
<div class="not-found">
<div class="status">
404
</div>
<div class="message">
Page Not Found!
</div>
</div>
</template>
<style lang="scss" scoped>
@import '~/scss/main';
.not-found {
line-height: 1.2;
text-align: center;
font-family: "Oswald", sans-serif;
padding: 80px 20px;
.status {
font-size: 160px;
color: $primary;
}
.message {
font-size: 50px;
}
}
</style>
'영화 검색 사이트' 카테고리의 다른 글
[영화 검색 사이트] Vuex Helpers(mapState) (0) | 2023.02.12 |
---|---|
[영화 검색 사이트] 부트스트랩 Breakpoint(반응형), sass-loader (0) | 2023.02.12 |
[영화 검색 사이트] Vue 플러그인 (0) | 2023.02.11 |
[영화 검색 사이트] 영화 상세 페이지(스켈레톤 UI, Loader) (0) | 2023.02.11 |
[영화 검색 사이트] 로딩 애니메이션, Footer (0) | 2023.02.11 |