-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathcustomPaging.vue
78 lines (71 loc) · 1.33 KB
/
customPaging.vue
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
<docs>
---
order: 4
title:
zh-CN: 自定义分页
en-US: Custom Paging
---
## zh-CN
自定义分页展示。
## en-US
Custom paging display
</docs>
<template>
<a-carousel arrows dots-class="slick-dots slick-thumb">
<template #customPaging="props">
<a>
<img :src="getImgUrl(props.i)" />
</a>
</template>
<div v-for="item in 4" :key="item">
<img :src="getImgUrl(item - 1)" />
</div>
</a-carousel>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
const baseUrl =
'https://raw.githubusercontent.com/vueComponent/ant-design-vue/main/components/carousel/demo/';
export default defineComponent({
setup() {
const getImgUrl = (i: number) => {
return `${baseUrl}abstract0${i + 1}.jpg`;
};
return {
getImgUrl,
};
},
});
</script>
<style scoped>
/* For demo */
:deep(.slick-dots) {
position: relative;
height: auto;
}
:deep(.slick-slide img) {
border: 5px solid #fff;
display: block;
margin: auto;
max-width: 80%;
}
:deep(.slick-arrow) {
display: none !important;
}
:deep(.slick-thumb) {
bottom: 0px;
}
:deep(.slick-thumb li) {
width: 60px;
height: 45px;
}
:deep(.slick-thumb li img) {
width: 100%;
height: 100%;
filter: grayscale(100%);
display: block;
}
:deep .slick-thumb li.slick-active img {
filter: grayscale(0%);
}
</style>