From: Eduardo San Martin Morote Date: Wed, 31 Mar 2021 09:09:42 +0000 (+0200) Subject: docs: docs for pinia plugin X-Git-Tag: v0.2.2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ea8a5d8c6d8739b34ea85ef2d827749be11b475;p=thirdparty%2Fvuejs%2Fpinia.git docs: docs for pinia plugin --- 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