]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: wip
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 29 Mar 2021 12:17:26 +0000 (14:17 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 28 Apr 2021 17:45:38 +0000 (19:45 +0200)
docs/core-concepts/plugins.md

index fb1a413b3b2de1f03eb91cb97b784c80ae97313d..e3f53be93343caf5834625c8485f5d6132e9db7f 100644 (file)
@@ -9,9 +9,17 @@ Pinia stores can be fully extended thanks to a low level API. Here is a list of
 - Implement side effects like local storage
 - Apply **only** to specific stores
 
-Plugins are added to pinia with `pinia.use()`:
+Plugins are added to pinia with `pinia.use()`. The simplest example is adding a property to all stores by returning an object:
 
 ```js
 // add a property named `secret` to every store that is created after this plugin is installed
-pinia.use(() => ({ secret: '' }))
+pinia.use(() => ({ secret: 'the cake is a lie' }))
+
+// in another file
+const store = useStore()
+store.secret // 'the cake is a lie'
 ```
+
+## TypeScript
+
+When adding new properties to stores