| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <template>
- <div class="banner" :class="'terminal' + terminal">
- <swiper class="swiper" :indicator-dots="true" :autoplay="true" :style="{'height':componentContent.height + 'rpx'}">
- <swiper-item class="banner-item" v-for="(item,index) in bannerList" :key="index" :style="{backgroundImage: 'url('+ item.bannerUrl +')','height':componentContent.height + 'rpx'}">
- <div class="a-link" @click="jumpLink(item.linkObj)"><img class="img" :src="item.bannerUrl" v-show="item.bannerUrl" mode="widthFix"></div>
- </swiper-item>
- </swiper>
- <div class="swiper-pagination" slot="pagination"></div>
- </div>
- </template>
- <script>
- // import { directive, Swiper, SwiperSlide } from 'vue-awesome-swiper'
- // import 'swiper/css/swiper.css'
- import {funMixin} from '../config/mixin'
- export default {
- name: 'cereBanner',
- mixins: [funMixin],
- data () {
- return {
- // swiperOption: {
- // autoplay: false, // 可选选项,自动滑动
- // loop: true,
- // pagination: {
- // el: '.swiper-pagination'
- // }
- // }
- }
- },
- props: {
- terminal: {
- type: Number,
- default: 4
- },
- componentContent: {
- type: Object
- }
- },
- // components: {
- // Swiper,
- // SwiperSlide
- // },
- // directives: {
- // swiper: directive
- // },
- mounted() {
- this.$forceUpdate() // 刷新轮播图
- },
- computed: {
- bannerList: function () {
- console.log(this.componentContent)
- return this.componentContent.bannerData.filter(function (item) {
- return item.bannerUrl
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .banner{
- .banner-item {
- width: 100%;
- img {
- width: 100%;
- }
- }
- &.terminal4{
- ::v-deep .el-carousel{
- height: 100%;
- .el-carousel__container{
- height: 100%;
- }
- }
- .banner-item{
- background-repeat: no-repeat;
- background-position: center;
- background-size: auto 100%;
- img{
- display: none;
- }
- }
- }
- ::v-deep .uni-swiper-dots{
- display: flex;
- justify-content: center;
- bottom: 20upx;
- width: 100%;
- .uni-swiper-dot{
- width: 30upx;
- height: 4upx;
- background: #fff;
- opacity: 0.5;
- border-radius: 2upx;
- margin: 0 7.5upx;
- .uni-swiper-dot-active{
- opacity: 1;
- width: 58upx;
- }
- }
- }
- /* wx-swiper-dots wx-swiper-dots-horizontal */
- wx-swiper .wx-swiper-dot-active{
- width: 40rpx;
- border-radius: 10rpx;
- background: #eb544d;
- }
- //.swiper-pagination{
- // display: flex;
- // justify-content: center;
- // bottom: 20upx;
- // width: 100%;
- // ::v-deep .swiper-pagination-bullet{
- // width: 30upx;
- // height: 4upx;
- // background: #fff;
- // opacity: 0.5;
- // border-radius: 2upx;
- // margin: 0 7.5upx;
- // }
- // ::v-deep .swiper-pagination-bullet-active{
- // opacity: 1;
- // width: 58upx;
- // }
- //}
- }
- </style>
|