Skip to content

Commit

Permalink
docs: update combined inject example (#430)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
simplesmiler authored Aug 11, 2020
1 parent 1d02f65 commit 611ba5b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/cookbook/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,25 @@ export default Vue.extend({
import { Plugin } from '@nuxt/types'

declare module 'vue/types/vue' {
// this.$myInjectedFunction inside Vue components
interface Vue {
$myInjectedFunction(message: string): void
}
}

declare module '@nuxt/types' {
// nuxtContext.app.$myInjectedFunction inside asyncData, fetch, plugins, middleware, nuxtServerInit
interface NuxtAppOptions {
$myInjectedFunction(message: string): void
}
// nuxtContext.$myInjectedFunction
interface Context {
$myInjectedFunction(message: string): void
}
}

declare module 'vuex/types/index' {
// this.$myInjectedFunction inside Vuex stores
interface Store<S> {
$myInjectedFunction(message: string): void
}
Expand Down

0 comments on commit 611ba5b

Please sign in to comment.