]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: docs for pinia plugin
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 31 Mar 2021 09:09:42 +0000 (11:09 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 31 Mar 2021 09:09:42 +0000 (11:09 +0200)
src/plugin.ts

index d92cc12bf8849161d4e96b80a592cb0a90bf5b76..4f62bc9fb1f945bc124a04b15e0750db713ca174 100644 (file)
@@ -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<void> = function (_Vue) {
   // Equivalent of
   // app.config.globalProperties.$pinia = pinia