当前位置:网站首页>利用swiper实现轮播图
利用swiper实现轮播图
2022-06-25 22:09:00 【渊来有你】
vscode中实现轮播图
- 首先在终端下载组件
npm install --save swiper
2.然后在script中引入
<script>
import Swiper from 'swiper'
import 'swiper/dist/css/swiper.min.css'
3.在html中按需求使用
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
<!-- 如果需要分页器 -->
<div class="swiper-pagination"></div>
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div>
4.在export default 中
export default{
mounted () {
//创建一个swiper实例对象,来实现轮播
new Swiper ('.swiper-container', {
loop: true, // 循环模式选项
autoplay:true,//自动切换,等同于以下设置
/*autoplay: { delay: 3000, stopOnLastSlide: false, disableOnInteraction: true, },*/
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
},
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
})
},
即可实现,html页面中自己加图片参考官方网址https://www.swiper.com.cn/usage/index.html
边栏推荐
- Tensorflow中CSV文件数据读取
- Stream in PHP socket communication_ Understanding of select method
- 第五章 习题(124、678、15、19、22)【微机原理】【习题】
- Jenkins 发布PHP项目代码
- QT custom implemented calendar control
- Classic image segmentation network: UNET supports libtorch deployment reasoning [with code]
- 达梦数据库修改字段信息采坑记
- Compiling protobuf protocol files using makefile in PHP
- Uniapp -- list page of multi header tabs
- php中使用Makefile编译protobuf协议文件
猜你喜欢
随机推荐
c_ uart_ interface_ Example and offboard modes
C1. k-LCM (easy version)-Codeforces Round #708 (Div. 2)
森林的先序和中序遍历
Anaconda一文入门笔记
mysql集群
Kotlin空指针Bug
Tree class query component
Blob
在win10下使用visual studio2015链接mysql数据库
支付宝支付接口沙箱环境测试以及整合到一个ssm电商项目中
说说单例模式!
mysql5.7版本在配置文件my.ini[mysqld]加上skip-grant-tables后无法启动
数据同步
解析產品開發失敗的5個根本原因
Compiling protobuf protocol files using makefile in PHP
Customize the qcombobox drop-down box, right align the display, and slide the drop-down list
一文讲透研发效能!您关心的问题都在
Apache doris1.0 cluster setup, load balancing and parameter tuning
213.打家劫舍 II
Mutual conversion between QT utf8 and Unicode encoding, and the Unicode encoding output format is &xxxxx









