fix(client): Fix #6540

This commit is contained in:
syuilo 2020-07-15 18:03:08 +09:00
parent b6c3399abe
commit 9d3beb3174
1 changed files with 5 additions and 1 deletions

View File

@ -103,9 +103,13 @@ document.body.innerHTML = '<div id="app"></div>';
const store = createStore(); const store = createStore();
// 他のタブと永続化されたstateを同期
window.addEventListener('storage', e => { window.addEventListener('storage', e => {
if (e.key === 'vuex') { if (e.key === 'vuex') {
store.replaceState(JSON.parse(localStorage['vuex'])); store.replaceState({
...store.state,
...JSON.parse(e.newValue)
});
} else if (e.key === 'i') { } else if (e.key === 'i') {
location.reload(); location.reload();
} }