tab.vue
1.78 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<template>
<div class="channel-tab">
<a v-for="(index, item) in channel" v-bind:class="{focus: index === current}" v-on:click.prevent="changeChannel(index)" href="/{{item.channel}}">
<span class="name">{{item.name | uppercase}}</span>
</a>
</div>
</template>
<script>
const bus = require('common/vue-bus');
module.exports = {
props: {
current: {
type: Number,
default: 0
},
page: {
type: String,
default: 'channel'
},
},
data() {
return {
channel: [{
name: 'MEN男士',
channel: 'men'
}, {
name: 'WOMEN女士',
channel: 'women'
}, {
name: 'LIFESTYLE生活',
channel: 'lifestyle'
}]
};
},
methods: {
changeChannel(index) {
this.current = index;
bus.$emit('channel.change', this.page, this.channel[index].channel);
}
}
};
</script>
<style>
.channel-tab {
width: 100%;
height: 90px;
font-size: 24px;
text-align: center;
background: #fff;
a {
display: inline-block;
line-height: 90px;
width: 33%;
color: #999;
&.focus {
color: #000;
}
}
.name {
padding: 9px 0;
&.focus {
border-bottom: 4px solid #000;
}
}
.focus {
.name {
border-bottom: 4px solid #000;
}
}
}
</style>