Skip to content

Commit 611ba5b

Browse files
authored
docs: update combined inject example (#430)
Nuxt actually does inject value into `Context` ([source](https://github.com/nuxt/nuxt.js/blob/128c9743c40bf776af428e5ed36ea1a09a0ef7b8/packages/vue-app/template/index.js#L178)), so it should be covered in combined inject example.
1 parent 1d02f65 commit 611ba5b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

docs/cookbook/plugins.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,25 @@ export default Vue.extend({
7979
import { Plugin } from '@nuxt/types'
8080

8181
declare module 'vue/types/vue' {
82+
// this.$myInjectedFunction inside Vue components
8283
interface Vue {
8384
$myInjectedFunction(message: string): void
8485
}
8586
}
8687

8788
declare module '@nuxt/types' {
89+
// nuxtContext.app.$myInjectedFunction inside asyncData, fetch, plugins, middleware, nuxtServerInit
8890
interface NuxtAppOptions {
8991
$myInjectedFunction(message: string): void
9092
}
93+
// nuxtContext.$myInjectedFunction
94+
interface Context {
95+
$myInjectedFunction(message: string): void
96+
}
9197
}
9298

9399
declare module 'vuex/types/index' {
100+
// this.$myInjectedFunction inside Vuex stores
94101
interface Store<S> {
95102
$myInjectedFunction(message: string): void
96103
}

0 commit comments

Comments
 (0)