当前位置:网站首页>uniapp swiper 卡片轮播 修改指示点样式效果demo(整理)
uniapp swiper 卡片轮播 修改指示点样式效果demo(整理)
2022-08-03 07:49:00 【我是开心呀】
效果图:
<template>
<swiper class="swiper-box" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
:duration="duration" circular="true" previous-margin="20px" next-margin="20px">
<swiper-item v-for="(item, index) in info" :key="index">
<view :class="item.colorClass" class="swiper-item">
<image class="image" :src="item.url" mode="aspectFill" />
</view>
</swiper-item>
</swiper>
</template>
<script>
export default {
data() {
return {
indicatorDots: true, //是否显示面板指示点
autoplay: true, //是否自动切换
interval: 2000, //切换的间隔时间
duration: 500, //滑动动画时长
info: [{
colorClass: 'uni-bg-red',
url: 'https://img.zcool.cn/community/01hzxc63yqx11b9znjoimm3734.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100/format,webp/quality,Q_100',
content: '内容 A'
},
{
colorClass: 'uni-bg-green',
url: 'https://img.zcool.cn/community/01jsy5em8t7jzkbs17kncj3837.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100/format,webp/quality,Q_100',
content: '内容 B'
},
{
colorClass: 'uni-bg-blue',
url: 'https://img.zcool.cn/community/01dz1ugf5tuetaf47pyvxj3633.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100/format,webp/quality,Q_100',
content: '内容 C'
},
{
colorClass: 'uni-bg-green',
url: 'https://img.zcool.cn/community/01vfjnenucrnxlyi2luwzu3437.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100/format,webp/quality,Q_100',
content: '内容 D'
}
],
}
},
}
</script>
<style lang="scss">
.swiper-box {
/* width: 95%; */
height: 300rpx;
}
.swiper-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #999;
color: #fff;
margin: 10px;
border-radius: 15upx;
/* app上运行不显示图片,就需要加下面这行,设置高度 */
height: 280upx;
}
.image {
/* width: 750rpx; */
width: 100%;
height: 300rpx;
border-radius: 15upx;
}
/* 默认指示点的样式 */
.swiper-box .wx-swiper-dot {
width: 15rpx;
height: 15rpx;
background: indianred;
border-radius: 15rpx;
}
/* 选中指示点的样式 */
.swiper-box .wx-swiper-dot.wx-swiper-dot-active {
width: 30rpx;
height: 15rpx;
background: indianred;
border-radius: 15rpx;
}
</style>
原文链接:https://blog.csdn.net/qq_59795720/article/details/126118918?spm=1001.2014.3001.5502
边栏推荐
猜你喜欢

热部署系统实现

“碳中和”愿景下,什么样的数据中心才是我们需要的?

五、《图解HTTP》报文首部和HTTP缓存

volta管理node版本

"Swordsman Offer" brush questions print from 1 to the largest n digits

ViewModel 记录下 +

How to choose a reliable and formal training institution for the exam in September?

Postman will return to results generated CSV file to the local interface

审批流设计

学习Glide 常用场景的写法 +
随机推荐
力扣(LeetCode)214. 打家劫舍 II(2022.08.02)
品牌方发行NFT时,应如何考量实用性?
推荐系统-排序层-精排模型:LR、GBDT、Wide&Deep、DCN、DIN、DIEN、MMOE、PLE
使用pipreqs导出项目所需的requirements.txt(而非整个环境)
STL迭代器
C语言实现树的底层遍历--超简代码
ArcEngine (4) Use of MapControl_OnMouseDown
pyspark df secondary sorting
DSP Trick:向量长度估算
vim 折叠函数
Nacos使用实践
mysql 8.0.12 安装配置方法并--设置修改密码
pyspark @udf loop using variable problem
002-字段不为null
The use of the database table structure document generation tool screw
JS函数获取本月的第一天和最后一天
积分商城系统设计
依赖注入(DI),自动配置,集合注入
解决移动端有纵向滚动条但是不能滚动的问题
ArcEngine(五)用ICommand接口实现放大缩小