From 5ea8a5d8c6d8739b34ea85ef2d827749be11b475 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 31 Mar 2021 11:09:42 +0200 Subject: [PATCH] docs: docs for pinia plugin --- src/plugin.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/plugin.ts b/src/plugin.ts index d92cc12b..4f62bc9f 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,6 +1,28 @@ import { PluginFunction } from 'vue' import { piniaSymbol } from './rootStore' +/** + * Vue Plugin that must be installed for pinia to work. Note **you don't need + * this plugin if you are using Nuxt.js**. Use the `buildModule` instead: + * https://pinia.esm.dev/ssr/nuxt.html. + * + * @example + * ```js + * import Vue from 'vue' + * import { PiniaPlugin, createPinia } from 'pinia' + * + * Vue.use(PiniaPlugin) + * const pinia = createPinia() + * + * new Vue({ + * el: '#app', + * // ... + * pinia, + * }) + * ``` + * + * @param _Vue + */ export const PiniaPlugin: PluginFunction = function (_Vue) { // Equivalent of // app.config.globalProperties.$pinia = pinia -- 2.47.3