vue轮播图中间大两头小
<template>
<div v-if="items.length" class="full-page-slide-wrapper">
<swiper :options="swiperOption" ref="mySwiper">
<!-- slides -->
<template v-for="item in items">
<swiper-slide v-if="item.bannerImageUrl" :key="item.pid">
<img @click="toTopic(item)" :src="item.bannerImageUrl" alt>
</swiper-slide>
</template>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
</template>
<script type="text/ecmascript-6">
import 'swiper/dist/css/swiper.css'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import { getFirstConfig } from '@/services/main.service'
const COMPONENT_NAME = 'pull-page-slide'
export default {
name: COMPONENT_NAME,
data () {
return {
items: [],
defaultIndex: 0,
swiperOption: {
direction: 'horizontal',
loop: true,
autoplay: 5000,
slidesPerView: 'auto',
centeredSlides: true,
spaceBetween: 10,
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
bulletActiveClass: 'slide_dot_active',
bulletClass: 'slide_dot'
}
}
}
},
mounted () {
this.getConfig()
},
components: {
swiper,
swiperSlide
},
methods: {
handleClick () {
},
toTopic (item) {
if (item.topicId) {
this.$router.push({ name: 'topic.detail', params: { id: item.topicId } })
}
},
async getConfig () {
let { datas } = await getFirstConfig().catch(e => console.error(e))
this.items = datas
}
}
}
</script>
<style lang="scss">
.full-page-slide-wrapper {
width: 100%;
height: 140px;
background: white;
box-sizing: content-box;
padding-top: 15px;
margin-top: 10px;
position: relative;
overflow: hidden;
.swiper-container {
width: 100%;
height: 100%;
.swiper-wrapper {
display: flex;
align-items: center;
}
.swiper-slide {
width: calc(100% - 50px);
border-radius: 5px;
}
.swiper-slide-prev {
height: 90% !important;
}
.swiper-slide-next {
height: 90% !important;
}
}
img {
object-fit: fill;
height: 100%;
width: 100%;
border-radius: 5px;
}
.slide_dot {
display: inline-block;
margin: 5px;
width: 3px;
height: 3px;
background-color: #f2f2f2;
border-radius: 50%;
opacity: 0.5;
}
.swiper-pagination {
bottom: 0;
}
.slide_dot_active {
display: inline-block;
width: 7px;
height: 3px;
border-radius: 5px;
background: white;
opacity: 1;
}
}
</style>
图例

vue轮播图中间大两头小的更多相关文章
- vue轮播图插件之vue-awesome-swiper
移动端轮播图插件,在使用iview图形界面插件中的carousel组件无法实现触摸滑动后,转而使用vue-awesome-swiper插件 1.npm安装 npm i vue-awesome-swip ...
- vue轮播图插件vue-awesome-swiper的使用与组件化
不管是APP还是移动端网页开发,轮播图在大部分项目当中都是存在的,这时候如果用vue开发项目,选择一款好的插件并且封装好是很重要的 1. 推荐使用vue-awesome-swiper 安装:cnpm ...
- vue轮播图
vue开发中遇到这样一个需求实现导航栏和中间内容相结合实现页面滑动导航跟随改变的效果.看效果: 这里我用的是vue所带的插件:vue-awesome-swiper,传送门:https://www.np ...
- Vue轮播图插件---Vue-Awesome-Swiper
轮播图插件 Vue-Awesome-Swiper 地址:https://github.com/surmon-china/vue-awesome-swiper 安装:npm install vue-aw ...
- 做一个vue轮播图组件
根据huangyi老师的慕课网vue项目跟着做的,下面大概记录了下思路 1.轮播图的图 先不做轮播图逻辑部分,先把数据导进来,看看什么效果.在recommend组件新建一个recommends的数组, ...
- vue --轮播图
轮播图,可以使用mint-ui中的swipe HTML: <Swipe :auto="4000"> <SwipeItem v-for="item in ...
- vue轮播图实现
1.先安装组件 cnpm install vue-awesome-swiper; 2.在main.js下引入文件: import VueAwsomeSwiper from 'vue-awesome-s ...
- vue 轮播图插件 vue-awesome-swiper
1.npm安装 npm install vue-awesome-swiper --save 2.vue 引入 //在main.js 中全局引入 import VueAwesomeSwiper from ...
- vue music-抓取歌单列表数据(渲染轮播图)
下载安装新依赖 babel-runtime:对es6语法进行转译 fastclick:对移动端进行点击300毫秒延迟 ,,取消掉 babel-polyfill:API 先添加,在npm install ...
随机推荐
- pjb fabu
#!/bin/bash PyPath=/opt/shell/mysql LocaName=`pwd` bagname=`basename $LocaName` sleep 1s ConfList=`p ...
- fastclick原理剖析及其用法
移动端点击延迟事件 移动端浏览器在派发点击事件的时候,通常会出现300ms左右的延迟. 原因: 移动端的双击会缩放导致click判断延迟.这是为了检查用户是否在做双击.为了能够立即响应用户的点击事件, ...
- [oracle]解决ora-01034 oracle not available
一般都是数据库连接中断了,按照链接重连即可. https://jingyan.baidu.com/article/5552ef47c73eef518ffbc908.html
- BZOJ2882工艺
题目描述 小敏和小燕是一对好朋友. 他们正在玩一种神奇的游戏,叫Minecraft. 他们现在要做一个由方块构成的长条工艺品.但是方块现在是乱的,而且由于机器的要求,他们只能做到把这个工艺品最左边的方 ...
- consul剔除节点
查询节点注册 curl -s http://192.168.1.1:8500/v1/catalog/service/aaa | python -m json.tool 删除注册信息 curl http ...
- LOJ#2244 起床困难综合症
解:m = 0的部分分,直接模拟.有and 0的部分分,直接模拟.<=1000的部分分,枚举攻击力之后模拟.所有操作相同的部分分,可以合并成只有一个操作.然后枚举m或者逐位贪心. 正解是逐位贪心 ...
- 51nod1556 计算(默慈金数)
Problem 有一个\(1*n\)的矩阵,固定第一个数为\(1\),其他填正整数, 且相邻数的差不能超过\(1\),求方案数. \(n\le 10^6\) Solution 容易发现答案是\(f_n ...
- SQL Server 中字段的精度问题
在工作中遇到,一个多表联合查询的情况,查询出来的有些字段精度太高,小数点后达到8个0,现在客户要求报表只要精确到0.01 ,就是只要小数点后面只要保存两位,另外还需要四舍五入 在网上找了点资料,自己测 ...
- freetypeLCD显示
目录 freetypeLCD显示 安装交叉编译环境 配置 头文件和库的位置 编译安装 复制到PC编译工具链 复制到文件系统 运行测试 LCD显示 编码转换问题 简单显示 角度旋转 换行显示 居中显示 ...
- DirectX11--教程项目无法编译、运行的解决方法
综述 对于Win10系统的大多数用户来说,可以直接编译本教程对应的项目并运行.但也有部分用户由于某些原因可能会出现无法编译的情况. DirectX11 With Windows SDK完整目录 欢迎加 ...