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 ...
随机推荐
- 二叉树最近公共祖先(LeetCode)
给定一个二叉树, 找到该树中两个指定节点的最近公共祖先. 百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p.q,最近公共祖先表示为一个结点 x,满足 x 是 p.q 的祖先且 x 的深 ...
- Git学习指北
learnGitBranching:一个可视化学习 git 的网站 learngitbranching.js.org,虽然项目有些悠久,如果学习 git 的话可以来玩下
- Python——pyqt5——智能提示(lineEdit/conmbobox)
一.文本框智能补全 completer = QtWidgets.QCompleter(data) completer.setCompletionMode(QtWidgets.QCompleter.Po ...
- 如何使用django操作数据库,向原有表中添加新的字段信息并建立一个多对多的关系?
(注:本人用的pycharm开发工具) 1.在你要添加新字段的app的 models.py 文件中添加需要新增的字段(book表新增authors字段并和author建立多对多关系,author表新增 ...
- -bash: fork: Cannot allocate memory 问题的处理
今天生产机器突然无法登录了,正好有一个用top挂着,但是退出top,执行任何命令都报-bash: fork: Cannot allocate memory,但是查看内存还是有很多空闲,然后在百度上查了 ...
- 洛谷P3380 二逼平衡树
线段树+平衡树 我!又!被!卡!常!了! 以前的splay偷懒的删除找前驱后继的办法被卡了QAQ 放一个在洛谷开O2才能过的代码..我太菜了.. #include <bits/stdc++.h& ...
- python学习day20 面向对象(二)类成员&成员修饰符
1.成员 类成员 类变量 绑定方法 类方法 静态方法 属性 实例成员(对象) 实例变量 1.1实例变量 类实例化后的对象内部的变量 1.2类变量 类中的变量,写在类的下一级和方法同一级. 访问方法: ...
- LOJ#2244 起床困难综合症
解:m = 0的部分分,直接模拟.有and 0的部分分,直接模拟.<=1000的部分分,枚举攻击力之后模拟.所有操作相同的部分分,可以合并成只有一个操作.然后枚举m或者逐位贪心. 正解是逐位贪心 ...
- cenos7上部署python3环境以及mysqlconnector2.1.5
本机的python2不要管他,因为可能有程序依赖目前的python2环境,比如yum!!!!! 一.安装python3依赖环境: yum -y install zlib-devel bzip2-dev ...
- 核心类生成-Mybatis Generator的使用
总结一下Generator的使用,首先要设计好数据表,然后修改generator.xml中的配制,接着直接运行命令就可以了. 第一步:数据库设计: 生成数据表代码: /* Navicat MySQL ...