Fix: Tabs and tab headers no longer lose sync when changing characters
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
class="fill-height"
|
class="fill-height"
|
||||||
>
|
>
|
||||||
<v-tabs-items
|
<v-tabs-items
|
||||||
:value="$store.state.characterSheetTabs[$route.params.id]"
|
:value="$store.getters.tabById($route.params.id)"
|
||||||
@change="e => $store.commit(
|
@change="e => $store.commit(
|
||||||
'setTabForCharacterSheet',
|
'setTabForCharacterSheet',
|
||||||
{id: $route.params.id, tab: e}
|
{id: $route.params.id, tab: e}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
centered
|
centered
|
||||||
grow
|
grow
|
||||||
max="100px"
|
max="100px"
|
||||||
:value="$store.state.characterSheetTabs[$route.params.id]"
|
:value="$store.getters.tabById($route.params.id)"
|
||||||
@change="e => $store.commit(
|
@change="e => $store.commit(
|
||||||
'setTabForCharacterSheet',
|
'setTabForCharacterSheet',
|
||||||
{id: $route.params.id, tab: e}
|
{id: $route.params.id, tab: e}
|
||||||
|
|||||||
@@ -17,6 +17,16 @@ const store = new Vuex.Store({
|
|||||||
characterSheetTabs: {},
|
characterSheetTabs: {},
|
||||||
showBuildDialog: false,
|
showBuildDialog: false,
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
// ...
|
||||||
|
tabById: (state) => (id) => {
|
||||||
|
if (id in state.characterSheetTabs){
|
||||||
|
return state.characterSheetTabs[id];
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
toggleDrawer (state) {
|
toggleDrawer (state) {
|
||||||
state.drawer = !state.drawer;
|
state.drawer = !state.drawer;
|
||||||
|
|||||||
Reference in New Issue
Block a user