article-image.vue
1.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
<template>
<div class="cover-slide">
<cube-slide ref="slide" :loop="false" :auto-play="false" :data="imageList">
<cube-slide-item v-for="(item, index) in imageList" :key="index" @click.native="clickHandler(item, index)">
<a click="javascript:void 0" class="square-img-container">
<SquareImg :src="item.image_url" :width="600" :height="600"/>
</a>
</cube-slide-item>
<template slot="dots" slot-scope="props">
<div class="dot-wrap">
{{props.current + 1}}/{{imageList.length}}
</div>
</template>
</cube-slide>
</div>
</template>
<script>
import { Slide } from 'cube-ui';
import SquareImg from '../../product/components/square-img';
export default {
name: 'articleImage',
components: {
'cube-slide': Slide,
'cube-slide-item': Slide.Item,
SquareImg
},
props: {
imageList: Array
},
data() {
return {
};
},
methods: {
clickHandler(item, index) {
console.log(item, index);
}
}
};
</script>
<style lang="scss" scoped>
.cover-slide {
flex: 1;
.square-img-container {
display: block;
width: 100%;
height: 750px;
margin: 0 auto;
}
.dot-wrap {
margin-left: 24px;
margin-bottom: 24px;
background: #000;
opacity: 0.5;
width: 80px;
height: 48px;
border-radius: 30px;
color: white;
font-size: 24px;
letter-spacing: 1.96px;
line-height: 48px;
text-align: center;
}
}
.cube-slide-item {
img {
margin: 0 auto;
}
}
</style>