]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: Fix incorrect flush-timing description in zh docs (#3021) v3
authorAaron Bird <25508292+Aaron-Bird@users.noreply.github.com>
Sat, 2 Aug 2025 17:11:17 +0000 (01:11 +0800)
committerGitHub <noreply@github.com>
Sat, 2 Aug 2025 17:11:17 +0000 (19:11 +0200)
packages/docs/zh/core-concepts/state.md

index f0221e1423c6961ef79bde3e91d8b3cf3709c8ad..b31f7dee135552abb0cc5b4ae0829d9c567259dd 100644 (file)
@@ -259,7 +259,7 @@ cartStore.$subscribe((mutation, state) => {
 在底层实现上,`$subscribe()` 使用了 Vue 的 `watch()` 函数。你可以传入与 `watch()` 相同的选项。当你想要在 **每次** state 变化后立即触发订阅时很有用:
 
 ```ts{4}
-cartStore.$subscribe((state) => {
+cartStore.$subscribe((mutation, state) => {
   // 每当状态发生变化时,将整个 state 持久化到本地存储
   localStorage.setItem('cart', JSON.stringify(state))
 }, { flush: 'sync' })