Function app.provide()
Provide a value that can be injected in all
descendant components within the application.
interface App {
provide<T>(key: InjectionKey<T> | symbol | string, value: T): this
}
import { createApp } from 'vue'
const app = createApp(/* ... */)
app.provide('message', 'hello')
// Inside a component in the application
import { inject } from 'vue'
export default {
setup() {
console.log(inject('message')) // 'hello'
}
}