fix tabswitcher bugs
This commit is contained in:
parent
54fd7e2be6
commit
1187727b60
@ -1,4 +1,5 @@
|
|||||||
import Notifications from '../notifications/notifications.vue'
|
import Notifications from '../notifications/notifications.vue'
|
||||||
|
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
|
||||||
|
|
||||||
const tabModeDict = {
|
const tabModeDict = {
|
||||||
mentions: ['mention'],
|
mentions: ['mention'],
|
||||||
@ -20,7 +21,8 @@ const Interactions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Notifications
|
Notifications,
|
||||||
|
TabSwitcher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// eslint-disable-next-line no-unused
|
// eslint-disable-next-line no-unused
|
||||||
import { h } from 'vue'
|
import { h, Fragment } from 'vue'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { FontAwesomeIcon as FAIcon } from '@fortawesome/vue-fontawesome'
|
import { FontAwesomeIcon as FAIcon } from '@fortawesome/vue-fontawesome'
|
||||||
|
|
||||||
@ -43,14 +43,14 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
active: findFirstUsable(this.$slots.default())
|
active: findFirstUsable(this.slots())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
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().findIndex(slot => this.activeTab === slot.key)
|
||||||
} else {
|
} else {
|
||||||
return this.active
|
return this.active
|
||||||
}
|
}
|
||||||
@ -74,6 +74,9 @@ 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 () {
|
||||||
|
if (this.$slots.default()[0].type === Fragment) {
|
||||||
|
return this.$slots.default()[0].children
|
||||||
|
}
|
||||||
return this.$slots.default()
|
return this.$slots.default()
|
||||||
},
|
},
|
||||||
setTab (index) {
|
setTab (index) {
|
||||||
|
Loading…
Reference in New Issue
Block a user