You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/docs/core-concepts/state.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,13 +87,23 @@ interface UserInfo {
87
87
88
88
By default, you can directly read from and write to the state by accessing it through the `store` instance:
89
89
90
-
```js
90
+
```ts
91
91
const store =useStore()
92
92
93
93
store.count++
94
94
```
95
95
96
-
Note you cannot add a new state property **if you don't define it in `state()`**. It must contain the initial state. e.g.: we can't do `store.secondCount = 2` if `secondCount` is not defined in `state()`.
96
+
Yes, this means **no verbose wrappers** like in Vuex, you can directly bind that to `v-model`:
97
+
98
+
```vue-html
99
+
<input v-model="store.count" type="number" />
100
+
```
101
+
102
+
::: info
103
+
104
+
You cannot add a new state property **if you don't define it in `state()`**. It must contain the initial state. e.g.: we can't do `store.secondCount = 2` if `secondCount` is not defined in `state()`.
0 commit comments