小程序实现轮播图
先看效果:
上代码:
1. html页面
<!--pages/swiper/swiper.wxml-->
<swiper
indicator-dots="true"
autoplay="true"
interval="1000"
duration="800"
circular="true"
>
<!-- <block wx:for="{{imgUrls}}"> -->
<view>
<swiper-item>
<image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.7v6.net%2Fuploads%2Fallimg%2F200417%2F141-20041F93144926.jpg&refer=http%3A%2F%2Fwww.7v6.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1625966518&t=e04664d665442db8ec5a7ca155095867" class="slide-image" />
</swiper-item>
<swiper-item>
<image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.7v6.net%2Fuploads%2Fallimg%2F200417%2F141-20041F93144926.jpg&refer=http%3A%2F%2Fwww.7v6.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1625966518&t=e04664d665442db8ec5a7ca155095867" class="slide-image" />
</swiper-item>
<swiper-item>
<image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.7v6.net%2Fuploads%2Fallimg%2F200417%2F141-20041F93144926.jpg&refer=http%3A%2F%2Fwww.7v6.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1625966518&t=e04664d665442db8ec5a7ca155095867" class="slide-image" />
</swiper-item>
</view>
</swiper>
2. 当然是css
swiper {
height: 400rpx;
width: 100%;
}
swiper-item {
height: 100%;
width: 100%;
}
.slide-image{
height: 100%;
width: 100%;
}
3. 就没有了,就这样就可以了。快去试试吧!如果不错请点赞评论