From: Eduardo San Martin Morote Date: Mon, 31 May 2021 14:28:57 +0000 (+0200) Subject: docs: note about using `Vue.set()` X-Git-Tag: v2.0.0-beta.1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3f18f772fb84997a8dbd21a2cab6035adcf1518;p=thirdparty%2Fvuejs%2Fpinia.git docs: note about using `Vue.set()` Close #452 --- diff --git a/docs/core-concepts/state.md b/docs/core-concepts/state.md index c0e9a425..48a7bedc 100644 --- a/docs/core-concepts/state.md +++ b/docs/core-concepts/state.md @@ -19,6 +19,10 @@ const useStore = defineStore({ }) ``` +:::tip +If you are using Vue 2, the data you create in `state` follows the same rules as the `data` in a Vue instance, ie the state object must be plain and you need to call `Vue.set()` when **adding new** properties to it. **See also: [Vue#data](https://vuejs.org/v2/api/#data)**. +::: + ## Accessing the `state` By default, you can directly read and write to the state by accessing it through the `store` instance: