brand-list.vue
3.5 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
<template>
<div>
<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 :href="brand.domain | brandUrl">
<div class="brand-logo">
<img :src="brand.logo | resize(136, 136)" :alt="brand.name">
</div>
<span class="brand-name">{{brand.name}}</span>
</a>
</div>
</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;
a {
font-size: 32px;
}
}
}
.brand-big-box {
width: 100%;
}
.brand-box {
width: 172px;
height: 162px;
float: left;
overflow: hidden;
text-align: center;
margin-bottom: 20px;
.brand-logo {
margin: 0 auto;
width: 136px;
height: 136px;
overflow: hidden;
img {
width: 100%;
}
}
.brand-name {
width: 136px;
font-size: 18px;
color: #d0d0d0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: inline-block;
}
}
}
.index-list {
top: 90px !important;
}
</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: []
};
},
watch: {
channel() {
this.getBrandList();
}
},
methods: {
getBrandList() {
let data = {
channel: this.channel
};
$.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.channel = channel;
});
}
};
</script>