From a3f18f772fb84997a8dbd21a2cab6035adcf1518 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 31 May 2021 16:28:57 +0200 Subject: [PATCH] docs: note about using `Vue.set()` Close #452 --- docs/core-concepts/state.md | 4 ++++ 1 file changed, 4 insertions(+) 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: -- 2.47.2