Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

当组件被卸载时subscriptions将被自动删除 #54

Open
zyd19960625 opened this issue Jul 28, 2022 · 1 comment
Open

当组件被卸载时subscriptions将被自动删除 #54

zyd19960625 opened this issue Jul 28, 2022 · 1 comment

Comments

@zyd19960625
Copy link

默认情况下,state subscriptions 绑定到添加它们的组件(如果 store 位于组件的 setup() 中)。 意思是,当组件被卸载时,它们将被自动删除。 如果要在卸载组件后保留它们,请将 { detached: true } 作为第二个参数传递给 detach 当前组件的 state subscription

see here

store.$subscribe(() => {
      strategies.forEach((strategy) => {
        updateStorage(strategy, store);
      });
},{ detached: true });
@wa-monster
Copy link

我也遇到这个了,但是这个绑定到添加他们的组件具体是什么意思了

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants