We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae7f547 commit f4b557aCopy full SHA for f4b557a
packages/docs/zh/core-concepts/state.md
@@ -259,7 +259,7 @@ cartStore.$subscribe((mutation, state) => {
259
在底层实现上,`$subscribe()` 使用了 Vue 的 `watch()` 函数。你可以传入与 `watch()` 相同的选项。当你想要在 **每次** state 变化后立即触发订阅时很有用:
260
261
```ts{4}
262
-cartStore.$subscribe((state) => {
+cartStore.$subscribe((mutation, state) => {
263
// 每当状态发生变化时,将整个 state 持久化到本地存储
264
localStorage.setItem('cart', JSON.stringify(state))
265
}, { flush: 'sync' })
0 commit comments