Skip to content

Commit 5ca8223

Browse files
author
bootstrap-vue-bot
committed
Lint fixes bootstrap-vue#124
1 parent 95d97db commit 5ca8223

File tree

1 file changed

+105
-105
lines changed

1 file changed

+105
-105
lines changed

components/tabs.vue

Lines changed: 105 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,122 @@
11
<template>
2-
<div class="tabs" >
3-
<ul :class="['nav','nav-' + navStyle]">
4-
<li class="nav-item" v-for="(item,index) in items" @click="setActive(index)">
2+
<div class="tabs">
3+
<ul :class="['nav','nav-' + navStyle]">
4+
<li class="nav-item" v-for="(item,index) in items" @click="setActive(index)">
55
<span :class="['nav-link','btn',btnSize,item.active ? 'active' : '',item.disabled ? 'disabled' : '']">
66
{{item.title}}
77
</span>
8-
</li>
9-
</ul>
10-
<div class="tab-content">
11-
<slot></slot>
8+
</li>
9+
</ul>
10+
<div class="tab-content">
11+
<slot></slot>
12+
</div>
1213
</div>
13-
</div>
1414
</template>
1515

1616
<script>
17-
import {csstransitions} from '../utils/helpers';
17+
import {csstransitions} from '../utils/helpers';
1818
19-
// this is directly linked to the bootstrap animation timing in _tabs.scss
20-
// for browsers that do not support transitions like IE9 just change slide immediately
21-
const TRANSITION_DURATION = csstransitions() ? 150 : 0;
19+
// this is directly linked to the bootstrap animation timing in _tabs.scss
20+
// for browsers that do not support transitions like IE9 just change slide immediately
21+
const TRANSITION_DURATION = csstransitions() ? 150 : 0;
2222
23-
// export component object
24-
export default {
25-
replace: true,
26-
data() {
27-
let currentTab = this.value || 0
28-
return {
29-
currentTab,
30-
items: []
31-
};
32-
},
33-
computed: {
34-
btnSize() {
35-
return !this.size || this.size === 'default' ? '' : `btn-${this.size}`;
36-
}
37-
},
38-
props: {
39-
fade: {
40-
type: Boolean,
41-
default: true
42-
},
43-
size: {
44-
type: String,
45-
default: 'md'
46-
},
47-
value: {
48-
type: Number,
49-
default: 0
50-
},
51-
navStyle: {
52-
type: String,
53-
default: 'tabs'
54-
}
55-
},
56-
watch: {
57-
currentTab (val) {
58-
this.$emit('input', val)
59-
},
60-
value (val) {
61-
this.setActive(val);
62-
}
63-
},
64-
methods: {
23+
// export component object
24+
export default {
25+
replace: true,
26+
data() {
27+
const currentTab = this.value || 0;
28+
return {
29+
currentTab,
30+
items: []
31+
};
32+
},
33+
computed: {
34+
btnSize() {
35+
return !this.size || this.size === 'default' ? '' : `btn-${this.size}`;
36+
}
37+
},
38+
props: {
39+
fade: {
40+
type: Boolean,
41+
default: true
42+
},
43+
size: {
44+
type: String,
45+
default: 'md'
46+
},
47+
value: {
48+
type: Number,
49+
default: 0
50+
},
51+
navStyle: {
52+
type: String,
53+
default: 'tabs'
54+
}
55+
},
56+
watch: {
57+
currentTab(val) {
58+
this.$emit('input', val);
59+
},
60+
value(val) {
61+
this.setActive(val);
62+
}
63+
},
64+
methods: {
6565
66-
/**
67-
* get an index of an active tab
68-
* @return {Number}
69-
*/
70-
getActive() {
71-
let active = -1;
72-
this.items.forEach((item, index) => {
73-
if (item.active) {
74-
active = index;
75-
}
76-
});
77-
return active;
78-
},
66+
/**
67+
* get an index of an active tab
68+
* @return {Number}
69+
*/
70+
getActive() {
71+
let active = -1;
72+
this.items.forEach((item, index) => {
73+
if (item.active) {
74+
active = index;
75+
}
76+
});
77+
return active;
78+
},
7979
80-
/**
81-
* set active tab on the items collection and the child 'tab' component
82-
*/
83-
setActive(index) {
84-
// ignore disabled
85-
if (this.items[index].disabled) {
86-
return;
87-
}
80+
/**
81+
* set active tab on the items collection and the child 'tab' component
82+
*/
83+
setActive(index) {
84+
// ignore disabled
85+
if (this.items[index].disabled) {
86+
return;
87+
}
8888
89-
// deactivate previous active tab
90-
const activeTab = this.getActive();
91-
if (activeTab !== -1) {
92-
// setting animate to false will trigger fade out effect
93-
this.items[activeTab].active = false;
94-
this.$set(this.$children[activeTab], 'animate', false);
95-
this.$set(this.$children[activeTab], 'active', false);
96-
}
89+
// deactivate previous active tab
90+
const activeTab = this.getActive();
91+
if (activeTab !== -1) {
92+
// setting animate to false will trigger fade out effect
93+
this.items[activeTab].active = false;
94+
this.$set(this.$children[activeTab], 'animate', false);
95+
this.$set(this.$children[activeTab], 'active', false);
96+
}
9797
98-
// set new active tab and animate (if fade flag is set to true)
99-
this.$set(this.$children[index], 'active', true);
100-
this._tabAnimation = setTimeout(() => {
101-
// setting animate to true will trigger fade in effect
102-
this.items[index].active = true;
103-
this.$set(this.$children[index], 'animate', true);
104-
this.$root.$emit('changed::tab', this.items[index].id);
105-
}, this.fade ? TRANSITION_DURATION : 0);
98+
// set new active tab and animate (if fade flag is set to true)
99+
this.$set(this.$children[index], 'active', true);
100+
this._tabAnimation = setTimeout(() => {
101+
// setting animate to true will trigger fade in effect
102+
this.items[index].active = true;
103+
this.$set(this.$children[index], 'animate', true);
104+
this.$root.$emit('changed::tab', this.items[index].id);
105+
}, this.fade ? TRANSITION_DURATION : 0);
106106
107-
// store currentActive
108-
this.currentTab = index
109-
}
110-
},
111-
mounted() {
112-
// if no active tab, set the first one by default
113-
if (this.getActive() === -1) {
114-
this.setActive(this.currentTab);
115-
}
116-
},
117-
destroyed() {
118-
clearTimeout(this._tabAnimation);
119-
}
120-
};
107+
// store currentActive
108+
this.currentTab = index;
109+
}
110+
},
111+
mounted() {
112+
// if no active tab, set the first one by default
113+
if (this.getActive() === -1) {
114+
this.setActive(this.currentTab);
115+
}
116+
},
117+
destroyed() {
118+
clearTimeout(this._tabAnimation);
119+
}
120+
};
121121
122122
</script>

0 commit comments

Comments
 (0)