Vue#15 - nested router
1. children : router 안에 router만들기
children안에 { } 만들기
"/detail/:id/author" "/detail/:id/comment"로 접속{ path : "/detail/:id", component : Detail, children : [ { path : "author", // '/' 필요 X component : Author.vue, }, { path : "comment", component : Comment.vue, }, ] },
그리고 어디서 보여줄 지 보여줄 곳에
<router-view></router-view> ``` 표시
2. router 함수
> 1. push()
@click="$router.push('/')" - 클릭 시 원하는 url로 이동
> 2. go()
@click="$router.go(-1)" - 웹브라우저의 히스토리에서 뒤로 한칸
@click="$router.go(2)" - 앞으로 두칸
3. named view - 여러개의 컴포넌트를 보여줄 때
path : "/list",
component : {
List : List,s
Comment : Comment,
},
4. redirection - 다른 페이지로 강제 이동
{
path : "/list",
redirection : { name : 'homepage' }
}
❗ $route는 현재경로, $router는 페이지 이동 관련 ❗
Author And Source
이 문제에 관하여(Vue#15 - nested router), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@shinoung2360/Vue14-nested-router저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)