From: Eduardo San Martin Morote Date: Tue, 19 Mar 2024 09:42:26 +0000 (+0100) Subject: docs: markup X-Git-Tag: @pinia/nuxt@0.5.2-beta.0~34 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ba4558abdbee831c5a9f435fc6a5115667eae30;p=thirdparty%2Fvuejs%2Fpinia.git docs: markup --- diff --git a/packages/docs/core-concepts/plugins.md b/packages/docs/core-concepts/plugins.md index a05f38cd..0f1efdc9 100644 --- a/packages/docs/core-concepts/plugins.md +++ b/packages/docs/core-concepts/plugins.md @@ -175,15 +175,15 @@ pinia.use(({ store }) => { } store.hasError = toRef(store.$state, 'hasError') - // make sure to set the context (`this`) to the store + // make sure to set the context (`this`) to the store const originalReset = store.$reset.bind(store) - // override the $reset function + // override the $reset function return { $reset() { originalReset() store.hasError = false - } + }, } }) ``` @@ -397,7 +397,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://nuxt.com/docs/guide/directory-structure/plugins) first. This will give you access to the `pinia` instance: -```ts +```ts{14-16} // plugins/myPiniaPlugin.ts import { PiniaPluginContext } from 'pinia' @@ -416,13 +416,17 @@ export default defineNuxtPlugin(({ $pinia }) => { }) ``` -Note the above example is using TypeScript, you have to remove the type annotations `PiniaPluginContext` and `Plugin` as well as their imports if you are using a `.js` file. +::: info + +The above example is using TypeScript, you have to remove the type annotations `PiniaPluginContext` and `Plugin` as well as their imports if you are using a `.js` file. + +::: ### Nuxt.js 2 If you are using Nuxt.js 2, the types are slightly different: -```ts +```ts{3,15-17} // plugins/myPiniaPlugin.ts import { PiniaPluginContext } from 'pinia' import { Plugin } from '@nuxt/types'