정의되지 않은 페이지는 404페이지를 사용자 정의하는 방법이다.


1. resources/js/components/Notfound.vue 파일을 만들어준다.


2. resources/js/routes.js  

1
import Notfound from './components/Notfound';
cs


1
2
3
4
5
6
        {
            path: '*',
 
            component: Notfound
        },
 
cs


전체

정의되지 않은 패스는 /components/Notfound 로 가게 설정하는 것이다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Logo from './components/Logo';
 
import LogoSymbol from './components/LogoSymbol';
 
import Colors from './components/Colors';
 
import Notfound from './components/Notfound';
 
export default{
 
    mode : 'history',
 
    linkActiveClass: 'font-bold text-blue-500',
 
    routes:[
        {
            path: '*',
 
            component: Notfound
        },
 
        {
            path: '/',
 
            component: Logo
        },
 
        {
            path: '/logo-symbol',
 
            component: LogoSymbol
        },
 
        {
            path: '/colors',
 
            component: Colors
        },
    ]
 
};
 
cs


3.routes/web.php 파일

1
2
3
4
Route::get('/{any?}', function () {
    return view('app');
})->where('any','.*');
 
cs


'라라벨 > Vue(laravle)' 카테고리의 다른 글

02) 레이아웃 tailwindcss  (0) 2020.01.13
01)라라벨에 뷰 라우터 설치하기  (0) 2020.01.13
laravel+vue+tailwindcss  (0) 2019.08.24
laravel vue axjos  (0) 2019.08.05
라라벨 뷰 적용하기  (0) 2019.08.03

+ Recent posts