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 ...
随机推荐
- .Net Core学习地址
官方教程:https://docs.microsoft.com/zh-cn/aspnet/core/ 入门无忧网:http://www.rm5u.com/netcore/netcore-intro.h ...
- Linux 系统从入门到精通的学习大纲;
以前没有接触过Linux,生产环境需要,有时候遇到问题,百度一下,问题解决了,在遇到问题,在百度,有时候问题是如何解决的,为什么会解决有点丈二的和尚摸不着头脑, 为此,想用一段时间,系统的学习下Lin ...
- 在PHP中如何把数组写成配置文件
1.配置文件 <?php return array ( 556770 => '65460d6684dcad3d0a92f1feb7fde199', 567701 => '9c2acd ...
- 【tensorflow】学习笔记
1.tensorflow中dynamic_rnn和rnn有什么区别? 在tensorflow中没有找到rnn这个方法难道是废弃掉了? rnn是静态图,比如有10个时间序列,那么它将全部展开,并且 ...
- ES 常用的查询语句介绍
elasticsearch定义了两种查询方式: 一.索引(index).type.document 相关语句 1.列出所有索引的状态 GET /_cat/indices?v health status ...
- Angular4.x学习日志
码云链接:https://gitee.com/ccsoftlucifer/Angular4Study 1.部署环境 安装nodejs 安装angular脚手架程序 2.创建工程 ng new 项目名 ...
- k8s网络之设计与实现
k8s网络主题系列: 一.k8s网络之设计与实现 二.k8s网络之Flannel网络 三.k8s网络之Calico网络 K8s网络设计与实现是在学习k8s网络过程中总结的内容.在学习k8s网络各种插件 ...
- 使用Docker安装ELK系列(超简单)
root权限 docker版本:1.13.1 ELK版本:6.4.3 项目中均关闭X-Pack 一.安装Elasticsearch 新建elasticsearch目录,并再其下新建文件config/e ...
- Java 集合系列03之 ArrayList详细介绍
ArrayList做为List接口中最常用的实现类,必须掌握. 一.ArrayList简介 与Java中的数组相比ArrayList的容量可以动态增加.它继承与AbstractList,实现了List ...
- Netty学习路线
预研时间170517-170519 投入时间:约10h 理解度:入门①前置基础:了解基本网络协议和通信方式[图解HTTP]http://download.csdn.net/detail/niehanm ...