gpt4 book ai didi

javascript - 持久化状态使用 vuex-persistedstate : store state in first tab doesnot update when i mutate state in another tab

转载 作者:行者123 更新时间:2023-12-03 07:11:24 25 4
gpt4 key购买 nike

您好,我正在使用 vuex persistedstate 来持久化我的状态。

import createPersistedState from 'vuex-persistedstate'

const store = new Vuex.Store({
// ...
plugins: [createPersistedState()]
})

我想做的是在另一个选项卡中更新商店状态,更新后的商店状态应该反射(reflect)在我的应用程序的其他打开的选项卡中。

我怎样才能做到这一点。

最佳答案

使用vuex-shared-mutations:

GitHub link

enter image description here

关于javascript - 持久化状态使用 vuex-persistedstate : store state in first tab doesnot update when i mutate state in another tab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49839307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com