From: Eduardo San Martin Morote Date: Mon, 10 Oct 2022 20:52:15 +0000 (+0200) Subject: docs: plugin in nuxt X-Git-Tag: @pinia/nuxt@0.4.4~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb63dd2aae8fec9fe3bffcce574866f6192f9bc3;p=thirdparty%2Fvuejs%2Fpinia.git docs: plugin in nuxt --- diff --git a/packages/docs/core-concepts/plugins.md b/packages/docs/core-concepts/plugins.md index 9513eb16..f8e46d3c 100644 --- a/packages/docs/core-concepts/plugins.md +++ b/packages/docs/core-concepts/plugins.md @@ -366,7 +366,7 @@ There is also a `StoreGetters` type to extract the _getters_ from a Store type. When [using pinia alongside Nuxt](../ssr/nuxt.md), you will have to create a [Nuxt plugin](https://nuxtjs.org/docs/2.x/directory-structure/plugins) first. This will give you access to the `pinia` instance: ```ts -// plugins/myPiniaPlugin.js +// plugins/myPiniaPlugin.ts import { PiniaPluginContext } from 'pinia' function MyPiniaPlugin({ store }: PiniaPluginContext) { @@ -388,8 +388,10 @@ Note the above example is using TypeScript, you have to remove the type annotati ### Nuxt.js 2 +If you are using Nuxt.js 2, the types are slightly different: + ```ts -// plugins/myPiniaPlugin.js +// plugins/myPiniaPlugin.ts import { PiniaPluginContext } from 'pinia' import { Plugin } from '@nuxt/types'