Fix: Tabs and tab headers no longer lose sync when changing characters

This commit is contained in:
Stefan Zermatten
2021-01-28 16:17:03 +02:00
parent d596061fa8
commit db83d5f82a
3 changed files with 12 additions and 2 deletions

View File

@@ -35,7 +35,7 @@
class="fill-height"
>
<v-tabs-items
:value="$store.state.characterSheetTabs[$route.params.id]"
:value="$store.getters.tabById($route.params.id)"
@change="e => $store.commit(
'setTabForCharacterSheet',
{id: $route.params.id, tab: e}

View File

@@ -81,7 +81,7 @@
centered
grow
max="100px"
:value="$store.state.characterSheetTabs[$route.params.id]"
:value="$store.getters.tabById($route.params.id)"
@change="e => $store.commit(
'setTabForCharacterSheet',
{id: $route.params.id, tab: e}

View File

@@ -17,6 +17,16 @@ const store = new Vuex.Store({
characterSheetTabs: {},
showBuildDialog: false,
},
getters: {
// ...
tabById: (state) => (id) => {
if (id in state.characterSheetTabs){
return state.characterSheetTabs[id];
} else {
return 0;
}
}
},
mutations: {
toggleDrawer (state) {
state.drawer = !state.drawer;