2
: JS 공통 모듈에- VueJs 내 응용 프로그램에서 경로를 따라 한
const router = new Router({
mode: 'history',
scrollBehavior:() => ({ y: 0 }),
routes: [
{ path: '/', component: HomePage, meta: { pageType: 'home'} },
],
});
을하고 있습니다
const trackEvent = {
getFields:() => {
//here need to access meta fields(pageType) of current route. how is it possible ?
}
}
export default trackEvent;
내가 메타에 액세스하려면 공통 모듈의 필드. 그게 어떻게 가능해 ?
나는 구성 요소에서 메타 필드를 전달하지 않고 JS 모듈의 메타 필드에 직접 액세스해야하는 몇 가지 유스 케이스가있다. –
자,이 경우에'router' 객체를 가져와야합니다. 내 편집을 참조하십시오. – thanksd