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

标签 javascript vue.js vuejs2 vuex

您好,我正在使用 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/

相关文章:

vue.js - Vue JS - 如何限制输入字段中的特殊字符?

javascript - win-listview的高度是怎么设置的? - WinJS

javascript - 如何使用 window.open() 限制在 Javascript 中打开的选项卡数量

javascript - 从字符串中获取变量

javascript - 计算单选按钮、选择和复选框的值

javascript - 如何在Vue js中将变量输入到函数中

javascript - Vue 2 在实例中使用外部变量

javascript - Vue 指令 v-for ="thing in collection"vs "thing of collection"

vue.js - 删除子组件(行)的意外行为

javascript - 页面刷新时导航到另一个路由 vuejs