我有一个使用 Vuex 的 Vue 应用程序。如果我打开了两个选项卡,则一个选项卡中对商店的更改不会显示在另一个选项卡中。
如何确保所有选项卡上的存储/数据立即同步?
const store = new Vuex.Store({
state: {
tasks: []
},
getters: {
tasks: state => state.tasks
}
}
Run Code Online (Sandbox Code Playgroud)
在模板中:
computed: {
tasks: function () {
return this.$store.getters.tasks
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6200 次 |
| 最近记录: |