Static GitHub Issues

[2941] accessing attributes on the matched component

prev: Env vars not loaded when running ava
next: How to conditionally set variables in PROD and DEV?

I saw this issue about retrieving metadata per page (effectively accessing this.$route.matched[0].components.default.options) but couldn't find any documentation as to why the key we're looking at on this.$route.matched[0].components is called default – and whether that's stable and I can rely on it.

I couldn't find anything in the vue-router docs for this, though it briefly mentions that matched is an array of Route Record copies. Looking at my /.nuxt/router.js file, I see this:

export function createRouter () {
  return new Router({
    mode: 'history',
    base: '/',
    linkActiveClass: 'nuxt-link-active',
    linkExactActiveClass: 'nuxt-link-exact-active',
    scrollBehavior,
    routes: [
		{
			path: "/about",
			component: _3b78a70e,
			name: "about"
		},
		{
			path: "/categories/:id?",
			component: _77c04516,
			name: "categories-id"
		},
		{
			path: "/",
			component: _5b3081d3,
			name: "index"
		}
    ],
    
    fallback: false
  })
}

Which isn't even setting a components option, much less one named default.

The second part (and this is maybe more of a Vue specific question) is how can I rely on <component>.options? I can't find any documentation anywhere (Vue, Nuxt, etc.) which states that this is an attribute that carries the user supplied options from Vue.component. Is this a stable api?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2552">#c2552</a>)</em></sub></div>