From 6e51774ccbc2628177b43126f089cfdc24acf713 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sat, 10 Aug 2019 00:26:29 -0400 Subject: [PATCH] use better name of controlled prop --- src/components/search/search.vue | 2 +- src/components/tab_switcher/tab_switcher.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/search/search.vue b/src/components/search/search.vue index eb20973b..746bbaa2 100644 --- a/src/components/search/search.vue +++ b/src/components/search/search.vue @@ -31,7 +31,7 @@ _.tag) @@ -26,12 +26,12 @@ export default Vue.component('tab-switcher', { } }, 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 + // In case of controlled component + if (this.activeTab) { + return this.$slots.default.findIndex(slot => this.activeTab === slot.key) === index + } else { + return this.active === index + } } }, render (h) { @@ -47,7 +47,7 @@ export default Vue.component('tab-switcher', { } if (slot.data.attrs.image) { return ( -
+