반응형
vue-properties가 중첩된 경로에 템플릿을 렌더링하지 않음
그래서 나는 다음과 같은 경로를 가지고 있다.
const routes = [{
path: '/',
component: Home,
children: [
{
path: "/health"
children: [
{
path: 'overview'
component: Overview
},
{
path: 'blood',
component: Blood
}
]
}
]
}]
홈 컴포넌트에는 다음과 같은 것이 있다.
<template>
<div id="home">
<router-view></router-view>
</div>
</template>
하지만 내가 그 곳으로 갈 때/health/overview
그리고/health/blood
구성 요소에 해당하는 템플릿은 렌더링되지 않는다.나는 앱을 확인했다.$route
물체는 경로와 구성 요소를 정확하게 감지한다.템플릿만으로는 렌더링되지 않는다.나 또한 a를 가지고 있다.<router-view>
나의App.vue
그게 도움이 된다면
다중 중첩된 경로를 가질 수 없는가?아니면 내가 뭘 놓치고 있는 걸까?
건강 경로는 다음과 같아야 한다.
{
path: 'health', // not '/health'
component: Health, // this can just be a dummy component with a <router-view/>
children: [...],
},
만약 당신이 필요 없다면Health
어떤 이유로든 구성 요소(즉, 각 아동에 걸쳐 공유된 기능이나 템플릿이 없음)를 사용하면 건강 경로를 완전히 제거하고 대신 다음과 같이 교체할 수 있다.
{
path: 'health/overview',
component: Overview,
},
{
path: 'health/blood',
component: Blood,
},
참조URL: https://stackoverflow.com/questions/43510137/vue-router-wont-render-template-on-nested-route
반응형
'programing' 카테고리의 다른 글
유사한 기능 구성요소에 대한 기존 Vue 구조(Vuex 포함) (0) | 2022.04.23 |
---|---|
C구조와 C++구조 (0) | 2022.04.23 |
Mac OS X에 Java 7을 설치했지만 터미널이 버전 6을 사용하고 있음 (0) | 2022.04.22 |
Vue.js에서 클릭 이벤트를 동적으로 삽입할 수 있는 방법이 있는가? (0) | 2022.04.22 |
Java 8 - 목록을 변환하는 가장 좋은 방법: 지도 또는 포어치? (0) | 2022.04.22 |