当前位置: 首页 > ds >正文

uniapp轮播 轮播图内有定位样式

自己收藏的
轮播图内有定位样式 轮播小点自定义样式。实现轮播。


<template><view class="container"><swiper class="swiper" :autoplay="true" :interval="3000" :duration="500"indicator-dotscircular><!-- 第一个轮播项:底图+相对定位图片 --><swiper-item><view class="slide-container"><!-- 底图 --><image class="base-image" src="https://kdwl-cw.oss-cn-beijing.aliyuncs.com/static/img/report_car.png" mode="aspectFill"></image><!-- 相对定位的图片 --><image class="overlay-image" src="https://kdwl-cw.oss-cn-beijing.aliyuncs.com/static/img/icon_1.png" mode="aspectFit"></image></view></swiper-item><!-- 第二个轮播项:底图+相对定位文字 --><swiper-item><view class="slide-container"><!-- 底图 --><image class="base-image" src="https://kdwl-cw.oss-cn-beijing.aliyuncs.com/static/img/report_car.png" mode="aspectFill"></image><!-- 相对定位的文字 --><view class="text-overlay"><text class="title">轮播图标题</text><text class="subtitle">这里是轮播图的描述文字内容</text></view></view></swiper-item></swiper></view>
</template><script>
export default {data() {return {}}
}
</script><style>
.container {width: 100%;height: 100%;
}.swiper {width: 100%;height: 640rpx;
}
/* 默认指示点的样式 */.swiper .wx-swiper-dot {width: 8rpx;height: 6rpx;background: #D8D8D8;border-radius: 3rpx;}/* 选中指示点的样式 */.swiper .wx-swiper-dot.wx-swiper-dot-active {width: 21rpx;height: 6rpx;background: #4172F0;border-radius: 3rpx;}.slide-container {width: 100%;height: 100%;position: relative;
}.base-image {width: 100%;height: 100%;
}.overlay-image {position: absolute;width: 200rpx;height: 200rpx;top: 50%;left: 50%;transform: translate(-50%, -50%);
}.text-overlay {position: absolute;bottom: 40rpx;left: 30rpx;color: #fff;text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.5);
}.title {font-size: 36rpx;font-weight: bold;display: block;margin-bottom: 10rpx;
}.subtitle {font-size: 24rpx;display: block;
}
</style>
http://www.xdnf.cn/news/18586.html

相关文章:

  • Oracle DB 10g 升级至 11.2.0.4报错-ORA-00132
  • Python办公之Excel(openpyxl)、PPT(python-pptx)、Word(python-docx)
  • NVM-Windows 命令大全
  • 量化交易 - 上证50利用动态PE增强模型 - python
  • React 学习笔记1 组件、State
  • 线性回归学习笔记
  • JAVA-15 (2025.08.20学习记录)
  • 集成电路学习:什么是Template Matching模版匹配
  • week3-[循环嵌套]好数
  • 基于Python与Tkinter开发的微博多功能自动化助手
  • Android焦点窗口变化导致遥控键值监听失效问题分析
  • # 重磅发布 | onecode 3.0.1 Base 源码正式开源:AI赋能的企业级开发框架
  • XXL-Job REST API 工具类完全解析:简化分布式任务调度集成
  • (第二十期上)HTML 超链接标签 a
  • 【python与生活】如何从视频中提取关键帧?
  • FPGA DP1.4 With DSC解决方案
  • 【华为OD-C卷-019 对称字符串 100分(python、java、c++、js、c)】
  • Vitest 测试框架完全指南 – 极速单元测试解决方案
  • C++ 常见的排序算法详解
  • AI 产业落地:从 “实验室神话” 到 “车间烟火气” 的跨越
  • Spring Cloud Netflix学习笔记06-Zuul
  • 机器学习中的集成算法与 k 均值聚类算法概述
  • uniapp跨域怎么解决
  • Go 并发编程-channel
  • 详解开源关键信息提取方案PP-ChatOCRv4的设计与实现
  • AI客服系统架构与实现:大模型、知识库与多轮对话的最佳实践
  • Android为ijkplayer设置音频发音类型usage
  • 【C2000常见问题】JTAG仿真器类型和JTAG Debug定位方法
  • 机器学习核心算法笔记:集成学习与聚类算法
  • springboot人事管理系统源码和论文