uniapp swiper的使用,一次显示多个,竖着排列

bash 复制代码
<view class="markList">
			<view class="list">
				<swiper class="swiper1" :indicator-dots="indicatorDots">
					<swiper-item v-for="(item,index) in pbgoodlist" :key="index" class="swiperitem">
						<view class="tittle">热招空白城市</view>
						<view class="item">
							<span v-for="(item1,index1) in item.list" :class="index1 <=2 ? 'red' : ''" :key="index1">{{index1 + 1}}.{{item1}}</span>
						</view>
					</swiper-item>
				</swiper>
			</view>
		</view>
bash 复制代码
.markList {
			margin: 45upx 30upx;

			.list {
				background: #fff;
				border-radius: 16upx;
				padding-bottom: 20upx;

				.swiper1 {
					height: 500upx;

					.swiperitem {
						.tittle {
							padding: 30upx 50upx;
						}

						.item {
							padding: 0 50upx;
							display: flex;
							flex-flow: column wrap;
							align-content: flex-start;
							height: 400upx;
							align-items: center;

							span {
								display: inline-flex;
								font-size: 30upx;
								align-items: center;
								width: 50%;
								margin-bottom: 30upx;
							}

							.red {
								color: red;
							}
						}
					}
				}
			}

		}
bash 复制代码
pbgoodlist: [{
						list: [
							'江西省赣州市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市'
						]
					},
					{
						list: [
							'江西省赣州市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市',
							'广西省三江市'
						]
					}
				],
				indicatorDots: true,

如果请求回来的数据是列表类型的话,需要处理一下结构在渲染:

bash 复制代码
this.pbgoodlist = res.data.data
			var data1 = this.pbgoodlist
			var list1 = []
			//一次显示5 个
			for (var i = 0, len = data1.length; i < len; i += 5) {
				list1.push(data1.slice(i, i + 5));
			}
			this.pbgoodlist = []
			for (var j = 0; j < list1.length; j++) {
				this.pbgoodlist.push(list1[j])
			}
相关推荐
2501_9160088913 小时前
iOS开发APP上架全流程解析:从开发到App Store的完整指南
android·ios·小程序·https·uni-app·iphone·webview
酷酷的鱼14 小时前
2026 跨平台开发终极选型:Flutter, React Native 与 uni-app x 深度博标与规划指南
flutter·react native·uni-app
biyezuopinvip14 小时前
基于uni-app和Express的问答对战小程序的设计与实现(论文)
小程序·uni-app·毕业设计·论文·express·毕业论文·问答对战小程序的设计与实现
2501_915909061 天前
Charles 抓不到包怎么办?iOS 调试过程中如何判断请求路径
android·ios·小程序·https·uni-app·iphone·webview
2501_916007471 天前
iOS和iPadOS文件管理系统全面解析与使用指南
android·ios·小程序·https·uni-app·iphone·webview
卜锦元1 天前
EchoChat搭建自己的音视频会议系统01-准备工作
c++·golang·uni-app·node.js·音视频
敲敲了个代码1 天前
让 Vant 弹出层适配 Uniapp Webview 返回键
前端·javascript·vue.js·学习·面试·uni-app
2501_915921432 天前
iOS App 开发阶段性能优化,观察 CPU、内存和日志变化
android·ios·性能优化·小程序·uni-app·iphone·webview
木子啊2 天前
UNIAPP国内房贷计算器
uni-app·房贷·房贷计算器·房贷利率·公积金贷款·商业贷款
游戏开发爱好者82 天前
在 iOS 开发、测试与上架过程中 如何做证书管理
android·ios·小程序·https·uni-app·iphone·webview