인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

No author

This post's author information has been deleted.

Getting Started with Vue.js - Age of Vue.js

Description of the area where the router is displayed and the router-view tag

vue-router 등록 조건(전역-컴포넌트만 등록 가능하다)?

Written on

·

280

1

안녕하세요, 강사님

 

vue-router 옵션 내부적으로 component를 등록할 때,

지역 컴포넌트로 등록된 컴포넌트는 라우팅 되지 않는 걸 확인하였습니다.

해당 사진은 공식문서를 캡쳐한 이미지인데요, 

this.appHeader 가 아니더라도 단순히 지역 컴포넌트가 선언된 위치를 찾아내서 연결만 시켜주면 되지 않을까 하는 생각이 있었는데 잘 안되더라구요, 

그냥 전역 컴포넌트나 싱글파일 컴포넌트 체계에서 라우팅 가능하다 정도로만 이해하면 될까요?

원하는 답변을 얻지 못해 질문합니다!

routes: [
{
path: '/header',
component: this.appHeader,
},
],

 

 
new Vue({
el: '#app',
router,
components: {
appHeader: {
template: '<header>app header</header>',
},
},
});

참고한 질문

javascriptvuejs

Answer 1

0

captain님의 프로필 이미지
captain
Instructor

안녕하세요 태현님, 라우터의 기본적인 사용법에 대해 다시 한번 확인해 보시면 좋을 것 같아요 :) 라우터는 URL 값에 따라 <router-view/> 태그에 지정된 컴포넌트가 그려집니다 :)

No author

This post's author information has been deleted.

Ask a question