uni里面怎么把轮播图的图片替换?
发布日期:2021-09-29 12:54:39 浏览次数:0 分类:技术文章

说起图片 那就整个循环啊  for循环来一个

<view class="uni-padding-wrap">			<view class="page-section swiper">				<view class="page-section-spacing">					<swiper class="swiper" :indicator-dots="xxx" :autoplay="autoplay" :interval="interval" :circular="circular"					 :duration="duration" indicator-color="rgb(141,161,159)" indicator-active-color="rgb(1,1,1)">						<swiper-item v-for='(item,index) in imgs' :key='index'>							<image :src="item" class="simg" mode="widthFix"></image>						</swiper-item>					</swiper>				</view>			</view>		</view>

好 本来他是有三个 swiper-item的  但是经过我们的修改 for循环遍历 后端给几个 我们就有几个

随便找了三个线上地址的

	imgs: [					'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1589025833389&di=3e89be437d4583010d6a5f06c1b5b960&imgtype=0&src=http%3A%2F%2Fimg1.imgtn.bdimg.com%2Fit%2Fu%3D1263550701%2C2004494872%26fm%3D214%26gp%3D0.jpg',					'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1589025827060&di=792a660ea87fed89c105e25ef489fdb3&imgtype=0&src=http%3A%2F%2Fwww.jituwang.com%2Fuploads%2Fallimg%2F160405%2F257858-160405000g246.jpg',					'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1237908509,3402766423&fm=26&gp=0.jpg'				],

效果达成

上一篇:JavaScript 函数式编程 实战开发
下一篇:vant在自定义的 van-dropdown-item