fix tabswitcher

This commit is contained in:
Henry Jameson 2022-03-17 08:47:11 +02:00
parent b62653c202
commit 0671aa0dd0
2 changed files with 4 additions and 4 deletions

View file

@ -63,7 +63,7 @@ const SettingsModalContent = {
const targetTab = this.$store.state.interface.settingsModalTargetTab const targetTab = this.$store.state.interface.settingsModalTargetTab
// We're being told to open in specific tab // We're being told to open in specific tab
if (targetTab) { if (targetTab) {
const tabIndex = this.$refs.tabSwitcher.$slots.default().findIndex(elm => { const tabIndex = this.$refs.tabSwitcher.$slots.default.findIndex(elm => {
return elm.data && elm.data.attrs['data-tab-name'] === targetTab return elm.data && elm.data.attrs['data-tab-name'] === targetTab
}) })
if (tabIndex >= 0) { if (tabIndex >= 0) {

View file

@ -43,14 +43,14 @@ export default {
}, },
data () { data () {
return { return {
active: findFirstUsable(this.$slots.default()) active: findFirstUsable(this.$slots.default)
} }
}, },
computed: { computed: {
activeIndex () { activeIndex () {
// In case of controlled component // In case of controlled component
if (this.activeTab) { if (this.activeTab) {
return this.$slots.default().findIndex(slot => this.activeTab === slot.key) return this.$slots.default.findIndex(slot => this.activeTab === slot.key)
} else { } else {
return this.active return this.active
} }
@ -74,7 +74,7 @@ export default {
}, },
// DO NOT put it to computed, it doesn't work (caching?) // DO NOT put it to computed, it doesn't work (caching?)
slots () { slots () {
return this.$slots.default() return this.$slots.default
}, },
setTab (index) { setTab (index) {
if (typeof this.onSwitch === 'function') { if (typeof this.onSwitch === 'function') {