brand-list.vue
2.88 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
<template>
<div class="brand-list-box">
<div v-for="item in brandList" 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">
<a href="{{brand.domain | brandUrl}}">
<div class="brand-logo">
<img v-lazy="brand.logo | resize 150 150" alt="{{brand.name}}">
</div>
<span class="brand-name">{{brand.name}}</span>
</a>
</div>
</div>
</div>
</div>
<index-list class="index-list" v-bind:index-list="indexList"></index-list>
</template>
<style>
.brand-list-box {
width: 100%;
.per-brand-box {
.index {
padding: 20px;
}
}
.brand-big-box {
width: 100%;
}
.brand-box {
width: 24%;
height: 180px;
float: left;
overflow: hidden;
text-align: center;
margin: 0 0.5%;
.brand-logo {
height: 150px;
overflow: hidden;
img {
width: 100%;
}
}
.brand-name {
width: 100%;
color: #d0d0d0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: inline-block;
}
}
}
.index-list {
top: 90px !important;
}
</style>
<script>
const $ = require('jquery');
const bus = require('common/vue-bus');
const tip = require('common/tip');
const indexList = require('component/tool/index-list.vue');
module.exports = {
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>