brand-shop-top.vue
2.8 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
<template>
<div class="brand-top-box" v-bind:style="{ 'background-image': `url(${brandIntro.brandBg})` }">
<div class="brand-bottom">
<img v-if="brandIntro.showBrandLogo" v-lazy="brandIntro.brandLogo" alt="{{ brandIntro.brandName }}">
<div v-else class="brand-title">{{ brandIntro.brandName }}</div>
<hr>
<div class="brand-intro line-clamp">{{ brandIntro.brandIntro }}</div>
</div>
<div class="expand"></div>
<div class="collapse"></div>
</div>
</template>
<style>
.brand-top-box {
width: 100%;
height: 468px;
color: #fff;
background-color: #000;
position: relative;
.brand-bottom {
width: 100%;
position: absolute;
bottom: 20px;
.brand-title {
margin-left: 5%;
font-size: 32px;
}
hr {
width: 90%;
border: #fff solid 1px;
border-top: none;
}
.brand-intro {
margin-left: 5%;
width: 90%;
height: 60px;
font-size: 16px;
line-height: 32px;
overflow: hidden;
text-overflow: ellipsis;
}
.line-clamp {
width: 82%;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.expand {
width: 60px;
height: 60px;
background: url("/channel/expand.png") no-repeat;
position: absolute;
bottom: 20px;
right: 5%;
}
.collapse {
width: 60px;
height: 60px;
background: url("/channel/collapse.png") no-repeat;
position: absolute;
bottom: 20px;
right: 5%;
display: none;
}
}
</style>
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
module.exports = {
props: ['domain'],
data() {
return {
brandIntro: {}
};
},
watch: {
domain() {
this.getShopIntro();
}
},
methods: {
getShopIntro() {
let data = {
domain: this.domain
};
$.ajax({
url: '/get-brand-intro',
data: data
}).then(result => {
this.brandIntro = result;
}).fail(() => {
tip('网络错误');
});
}
},
created() {
this.getShopIntro();
}
};
</script>