当前位置:网站首页>利用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
边栏推荐
- 树莓派开机发送热点进行远程登录
- 对伪类的理解
- Architecture part -- the use of UMI framework and DVA
- C# IO Stream 流(一)基础概念_基本定义
- How to generate get/set methods in idea
- Hibernate architecture introduction and environment construction (very detailed)
- Mutual conversion between QT utf8 and Unicode encoding, and the Unicode encoding output format is &xxxxx
- Uniapp -- framework arrangement and analysis summary
- idea 查看单元测试覆盖率
- The InputStream stream has been closed, but the file or folder cannot be deleted, indicating that it is occupied by the JVM
猜你喜欢
How does excel translate Chinese words into English automatically? This formula teaches you
Use Baidu map API to set an overlay (infowindow) in the map to customize the window content
iomanip头文件在实战中的作用
如何设计产品的roadmap?
6.常用指令(上)v-cloak,v-once,v-pre
Binary, hexadecimal, big end and small end
第六章 习题(678)【微机原理】【习题】
平衡二叉树AVL
Line height for small use
Style setting when there is a separator in the qcombobox drop-down menu
随机推荐
解析产品开发失败的5个根本原因
DPVS-FullNAT模式部署篇
记录一下刷LeetCode瞬间有思路的一道简单题——剑指 Offer 09. 用两个栈实现队列
Reproduction of an implant found by Kaspersky that writes shellcode into evenlog
Uniapp -- framework arrangement and analysis summary
C. Yet Another Card Deck-Educational Codeforces Round 107 (Rated for Div. 2)
如何进行流程创新,以最经济的方式提升产品体验?
final和static
The InputStream stream has been closed, but the file or folder cannot be deleted, indicating that it is occupied by the JVM
Spark日志分析
YUV444、YUV422、YUV420、YUV420P、YUV420SP、YV12、YU12、NV12、NV21
Px4 simulation basis
使用百度地图API在地图中设置一个覆盖物(InfoWindow),可自定义窗口内容
Bi-sql stored procedure (I)
Analysis on resource leakage /goroutine leakage / memory leakage /cpu full in go
unsigned与signed之大白话
mysql集群
C# IO Stream 流(一)基础概念_基本定义
森林的先序和中序遍历
IDEA中如何生成get/set方法