Interface ComponentCustomProperties

Custom properties added to component instances in any way and can be accessed through this

Example

Here is an example of adding a property $router to every component instance:

import { createApp } from 'vue'
import { Router, createRouter } from 'vue-router'

declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$router: Router
}
}

// effectively adding the router to every component instance
const app = createApp({})
const router = createRouter()
app.config.globalProperties.$router = router

const vm = app.mount('#app')
// we can access the router from the instance
vm.$router.push('/')
interface ComponentCustomProperties {
    $nuxt: NuxtApp;
    $pinia: Pinia;
    $route: RouteLocationNormalizedLoaded;
    $router: Router;
    $ustra: Ustra;
    _pStores?: Record<string, StoreGeneric>;
}

Properties

$nuxt: NuxtApp
$pinia: Pinia

Access to the application's Pinia

$route: RouteLocationNormalizedLoaded

Normalized current location. See RouteLocationNormalizedLoaded.

$router: Router

Router instance used by the application.

$ustra: Ustra
_pStores?: Record<string, StoreGeneric>

Cache of stores instantiated by the current instance. Used by devtools to list currently used stores. Used internally by Pinia.

Generated using TypeDoc