app.config.globalProperties
An object that can be used to register global
properties that can be accessed on any component
instance inside the application.
For example, we may install this.$http
for
data-fetching or this.$translate
for
internationalization.
interface AppConfig {
globalProperties: Record<string, any>
}
If a global property conflicts with a component’s
own property, the component’s own property will
have higher priority.
app.config.globalProperties.msg = 'hello'
This makes msg available inside any component
template in the application, and also on this of
any component instance:
export default {
mounted() {
console.log(this.msg) // 'hello'
}
}