当前位置:网站首页>利用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
边栏推荐
- 7.常用指令(下)v-on,v-bind,v-model的常见操作
- 平衡二叉树AVL
- Analysis on the control condition and mode of go cooperation overtime exit
- Unable to start debugging. Unexpected GDB output from command “-environment -cd xxx“ No such file or
- The InputStream stream has been closed, but the file or folder cannot be deleted, indicating that it is occupied by the JVM
- util. Collection and encapsulation of JS tool functions
- line-height小用
- The simplest screen recording to GIF gadget in history, licecap, can be tried if the requirements are not high
- php中使用Makefile编译protobuf协议文件
- Go language escape analysis complete record
猜你喜欢

Kotlin null pointer bug

为什么Integer的比较最好使用equals

今天说说String相关知识点

The simplest screen recording to GIF gadget in history, licecap, can be tried if the requirements are not high

How does excel translate Chinese words into English automatically? This formula teaches you

平衡二叉树AVL

7.常用指令(下)v-on,v-bind,v-model的常见操作

Bi-sql stored procedure (I)

期末复习【机器学习】

C ++ 引用与指针总结
随机推荐
Kotlin空指针Bug
One article explains R & D efficiency! Your concerns are
虚析构和纯虚析构及C ++实现
oracle写一个先插入一条数据,在将该数据中一个字段更新的触发器的坑
debezium
String object (constant) pool
Kylin
Analyse des cinq causes profondes de l'échec du développement de produits
动态验证码
The simplest screen recording to GIF gadget in history, licecap, can be tried if the requirements are not high
登录拦截器
Hibernate entity class curd, transaction operation summary
6.常用指令(上)v-cloak,v-once,v-pre
MySQL InnoDB锁知识点
Jenkins releases PHP project code
录屏转gif的好用小工具ScreenToGif,免费又好用!
C# IO Stream 流(二)扩展类_封装器
权限设计=功能权限+数据权限
4个要点,助力产品管好项目
Leetcode 513. 找树左下角的值