- 📦 Extremely light
- ⛰️ Nuxt Module
-Pinia works with both Vue 2 and Vue 3.
+The latest version of pinia works with Vue 3. See the branch [v2](https://github.com/vuejs/pinia/tree/v2) for a version that works with Vue 2.
Pinia is the most similar English pronunciation of the word _pineapple_ in Spanish: _piña_. A pineapple is in reality a group of individual flowers that join together to create a multiple fruit. Similar to stores, each one is born individually, but they are all connected at the end. It's also a delicious tropical fruit indigenous to South America.
app.mount('#app')
```
-```js
-// Vue 2
-import { createPinia, PiniaVuePlugin } from 'pinia'
-
-Vue.use(PiniaVuePlugin)
-const pinia = createPinia()
-
-new Vue({
- el: '#app',
- // other options...
- // ...
- // note the same `pinia` instance can be used across multiple Vue apps on
- // the same page
- pinia,
-})
-```
-
For more detailed instructions, including [Nuxt configuration](https://pinia.vuejs.org/ssr/nuxt.html#nuxt-js), check the [Documentation](https://pinia.vuejs.org).
### Create a Store
* store is used again, it will reuse the previous state.
*/
$dispose(): void
-
- /**
- * Vue 2 only. Is the store ready. Used for store cross usage. Getters automatically compute when they are added to
- * the store, before the store is actually ready, this allows to avoid calling the computed function yet.
- *
- * @internal
- */
- _r?: boolean
}
/**
? K
: // NOTE: there is still no way to have a different type for a setter and a getter in TS with dynamic keys
// https://github.com/microsoft/TypeScript/issues/43826
- // NOTE: to support Vue 2.7, we need to use Readonly and not infer the second type param
- // https://github.com/vuejs/pinia/issues/2767#issuecomment-2601284366
never]: G[K] extends Readonly<WritableComputedRef<infer R>> ? R : never
}