tabs.vue
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<template>
<div class="tabs-wrapper">
<Widget classes="iconhome" :class="active(0)" :index="0" desc="首页" @click="onClick"></Widget>
<Widget classes="iconcategoary" :class="active(1)" :index="1" desc="分类" @click="onClick"></Widget>
<Widget classes="iconmessage" :class="active(2)" :index="2" desc="消息" @click="onClick"></Widget>
<Widget classes="iconuser" :class="active(3)" :index="3" desc="我的" @click="onClick"></Widget>
</div>
</template>
<script>
import Widget from './widget';
export default {
name: 'IndexTab',
props: {
value: {
type: Number,
default: 0
}
},
components: {
Widget
},
computed: {
active() {
return (i) => {
return {
active: this.value === i
};
};
}
},
methods: {
onClick(index) {
this.$emit('click', index);
}
}
};
</script>
<style lang="scss" scoped>
.tabs-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 46px;
}
.active {
color: #08304b !important;
}
</style>