-
Vue 프로젝트 404 Page Not Found프로젝트/영화 검색 (Vue) 2021. 8. 20. 16:24
Vue 프로젝트 404 Page Not Found
1. /src/routes/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>
2. /src/routes/index.js 수정
/* 페이지를 관리해주는 구성 파일 */ ... import NotFound from './NotFound' export default createRouter({ ... routes: [ ... { path: '/about', component: About }, { path: '/:notFound(.*)', component: NotFound } ...
결과
참고
https://next.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
next.router.vuejs.org
'프로젝트 > 영화 검색 (Vue)' 카테고리의 다른 글
Vue 프로젝트 모든 컴포넌트에서 전역 스타일 가져오기 (0) 2021.08.21 Vue 프로젝트 부트스트랩 Breakpoint(반응형) (0) 2021.08.20 Vue 프로젝트 About (0) 2021.08.19 Vue 프로젝트 Nav 경로 일치 및 활성화 (0) 2021.08.19 Vue 프로젝트 영화 포스터가 없는 경우 예외 처리 (0) 2021.08.17