반응형
Vue.js 경로 변경 모달 열기
현재 나의vue-router
구성은 다음과 같다.
export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home,
},
{
path: '/settings',
name: 'settings',
component: Settings,
}
],
});
이제, 나는 새로운 길을 정의하고 싶다./some-modal-path
모달이라고 하는 모달로 항해할 때ModalComponent
는 현재 구성 요소 위에 오버레이로 열린다.
이 일을 할 수 있을까?vue-router
만약 그렇다면, 어떻게 할 수 있을까?
빠른 솔루션
놓다<router-view>
각 구성 요소별로
export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home,
children: [
{ path: '/some-modal-path',
component: ModalComponent,
name: 'ModalComponent'
}
]
},
{
path: '/settings',
name: 'settings',
component: Settings,
children: [
{ path: '/some-modal-path',
component: ModalComponent,
name: 'ModalComponent'
}
]
}
],
});
참조URL: https://stackoverflow.com/questions/49505691/open-a-modal-on-vue-js-route-change
반응형
'IT이야기' 카테고리의 다른 글
개체의 특성 나열 (0) | 2022.04.01 |
---|---|
뉴라인 없이 인쇄(인쇄 'a'), 인쇄 공간, 제거 방법? (0) | 2022.04.01 |
nuxt 라우터 모듈의 router.js 파일에서 Vuex 저장소에 액세스하는 방법? (0) | 2022.04.01 |
vuex에서 작업을 생성하는 올바른 방법 (0) | 2022.04.01 |
Python에서 도스 경로를 구성요소로 분할하는 방법 (0) | 2022.04.01 |