Skip to content

Commit f4b557a

Browse files
authored
docs: Fix incorrect flush-timing description in zh docs (#3021)
1 parent ae7f547 commit f4b557a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/docs/zh/core-concepts/state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ cartStore.$subscribe((mutation, state) => {
259259
在底层实现上,`$subscribe()` 使用了 Vue 的 `watch()` 函数。你可以传入与 `watch()` 相同的选项。当你想要在 **每次** state 变化后立即触发订阅时很有用:
260260

261261
```ts{4}
262-
cartStore.$subscribe((state) => {
262+
cartStore.$subscribe((mutation, state) => {
263263
// 每当状态发生变化时,将整个 state 持久化到本地存储
264264
localStorage.setItem('cart', JSON.stringify(state))
265265
}, { flush: 'sync' })

0 commit comments

Comments
 (0)