aboutsummaryrefslogtreecommitdiff
path: root/src/components/tab_switcher/tab_switcher.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-07-15 19:09:01 +0000
committerShpuld Shpludson <shp@cock.li>2019-07-15 19:09:01 +0000
commit3370dd80dc4644f2bff053b97b18698cd2abb550 (patch)
tree0f4ad9f266eafada88cf6314a276f30257a1f116 /src/components/tab_switcher/tab_switcher.js
parent7ed9d17ce745abc38a27d4994452a136357aba46 (diff)
parente9b452575b9a5ef87808898086771ae806fc3a8b (diff)
Merge branch 'develop' into 'feat/conversation-muting'
# Conflicts: # src/services/api/api.service.js
Diffstat (limited to 'src/components/tab_switcher/tab_switcher.js')
-rw-r--r--src/components/tab_switcher/tab_switcher.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js
index 81e4d333..67835231 100644
--- a/src/components/tab_switcher/tab_switcher.js
+++ b/src/components/tab_switcher/tab_switcher.js
@@ -4,7 +4,7 @@ import './tab_switcher.scss'
export default Vue.component('tab-switcher', {
name: 'TabSwitcher',
- props: ['renderOnlyFocused', 'onSwitch'],
+ props: ['renderOnlyFocused', 'onSwitch', 'customActive'],
data () {
return {
active: this.$slots.default.findIndex(_ => _.tag)
@@ -24,6 +24,14 @@ export default Vue.component('tab-switcher', {
}
this.active = index
}
+ },
+ isActiveTab (index) {
+ const customActiveIndex = this.$slots.default.findIndex(slot => {
+ const dataFilter = slot.data && slot.data.attrs && slot.data.attrs['data-filter']
+ return this.customActive && this.customActive === dataFilter
+ })
+
+ return customActiveIndex > -1 ? customActiveIndex === index : index === this.active
}
},
render (h) {
@@ -33,7 +41,7 @@ export default Vue.component('tab-switcher', {
const classesTab = ['tab']
const classesWrapper = ['tab-wrapper']
- if (index === this.active) {
+ if (this.isActiveTab(index)) {
classesTab.push('active')
classesWrapper.push('active')
}