mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 05:29:01 +08:00
bbfb3cef7d
* refactor:carousel * docs:update & refactor: carousel type --------- Co-authored-by: tangjinzhou <415800467@qq.com>
79 lines
1.3 KiB
Vue
79 lines
1.3 KiB
Vue
<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>
|