From 2c2b84d31dbe906b89dfb995394d887af110e04c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 5 Jul 2019 10:02:14 +0300 Subject: npm eslint --fix . --- src/components/tab_switcher/tab_switcher.js | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/components/tab_switcher/tab_switcher.js') diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index c949b458..81e4d333 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -10,6 +10,12 @@ export default Vue.component('tab-switcher', { active: this.$slots.default.findIndex(_ => _.tag) } }, + beforeUpdate () { + const currentSlot = this.$slots.default[this.active] + if (!currentSlot.tag) { + this.active = this.$slots.default.findIndex(_ => _.tag) + } + }, methods: { activateTab (index, dataset) { return () => { @@ -20,34 +26,28 @@ export default Vue.component('tab-switcher', { } } }, - beforeUpdate () { - const currentSlot = this.$slots.default[this.active] - if (!currentSlot.tag) { - this.active = this.$slots.default.findIndex(_ => _.tag) - } - }, render (h) { const tabs = this.$slots.default - .map((slot, index) => { - if (!slot.tag) return - const classesTab = ['tab'] - const classesWrapper = ['tab-wrapper'] + .map((slot, index) => { + if (!slot.tag) return + const classesTab = ['tab'] + const classesWrapper = ['tab-wrapper'] - if (index === this.active) { - classesTab.push('active') - classesWrapper.push('active') - } + if (index === this.active) { + classesTab.push('active') + classesWrapper.push('active') + } - return ( -
- -
- ) - }) + return ( +
+ +
+ ) + }) const contents = this.$slots.default.map((slot, index) => { if (!slot.tag) return -- cgit v1.2.3-70-g09d2