Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当组件被卸载时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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants