brand-list.vue
3.82 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
<div class="brand-list-box">
<div v-for="(item, index) in brandList" :key="index" class="per-brand-box">
<div class="index"><a :href="'#' + item.index" :name="item.index">{{item.index}}</a></div>
<div class="brand-big-box clearfix">
<div class="brand-box" v-for="brand in item.brands" :key="brand.name">
<a v-brand-href="brand.domain">
<span class="brand-name">{{brand.name}}</span>
</a>
</div>
</div>
</div>
<index-list class="index-list" :index-list="indexList"></index-list>
</div>
</template>
<style>
.brand-list-box {
width: 100%;
/* padding: 20px 0; */
background: #f6f6f6;
/* border-top: 1px solid #eee; */
.per-brand-box {
background: #fff;
/* padding: 0 30px; */
/* border-top: 1px solid #eee; */
/* border-bottom: 1px solid #eee; */
&:not(:first-of-type) {
/* margin-top: 20px; */
}
.index {
height: 60px;
line-height: 60px;
background-color: #f6f6f6;
padding: 0 30px;
font-weight: bold;
a {
font-size: 32px;
}
}
}
.brand-big-box {
width: 100%;
}
.brand-box {
width: 100%;
height: 80px;
line-height: 80px;
border-bottom: 1px solid #f6f6f6;
/* float: left; */
overflow: hidden;
/* text-align: center; */
.brand-logo {
margin: 0 auto;
width: 136px;
height: 136px;
overflow: hidden;
img {
width: 100%;
}
}
.brand-name {
/* width: 136px; */
font-size: 24px;
color: #000;
overflow: hidden;
/* white-space: nowrap; */
/* text-overflow: ellipsis; */
display: inline-block;
padding: 0 30px;
}
a {
height: 100%;
width: 100%;
display: inline-block;
font-weight: bold;
}
}
}
.index-list {
top: 50%;
transform: translateY(-50%);
}
</style>
<script>
import $ from 'jquery';
import bus from 'common/vue-bus';
import tip from 'common/tip';
import indexList from 'component/tool/index-list.vue';
export default {
props: ['channel'],
data() {
return {
brandList: [],
indexList: [],
currentChannel: this.channel,
};
},
watch: {
channel(val) {
this.currentChannel = val;
this.getBrandList();
}
},
methods: {
getBrandList() {
let data = {
channel: this.currentChannel
};
$.ajax({
url: '/brand/list.json',
data: data
}).then(result => {
this.brandList = result.brandList;
this.indexList = result.indexList;
}).fail(() => {
tip('网络错误');
});
}
},
components: {
indexList
},
created() {
this.getBrandList();
bus.$on('channel.change', (page, channel) => {
this.currentChannel = channel;
this.getBrandList();
});
}
};
</script>