出现画廊图片不居中的情况,<swiper>未撑满整个div

来源:9-2 Vue项目详情页 - 公用图片画廊组件拆分

慕的地2446357

2018-06-08

如下图所示

http://img.mukewang.com/szimg/5b19ede30001b52404520701.jpg

代码:

<template>

  <div class="container">

    <div class="wrapper">

      <swiper>

        <swiper-slide>

          <img class="gallary-img" src="//img1.qunarzz.com/sight/p0/1412/be/c788f0f3767d2ea037b9b66d2010bfa4.water.jpg_r_800x800_2ddc6f15.jpg" />

        </swiper-slide>

        <!-- <div class="swiper-pagination"  slot="pagination"></div> -->

      </swiper>

    </div>

  </div>

</template>


<script>

export default {

  name: 'CommonGallary'

}

</script>


<style socped>

  .container

    display: flex

    flex-direction: column

    justify-content: center

    z-index: 99

    position: fixed

    left: 0

    right: 0

    top: 0

    bottom: 0

    background: #000

    .wrapper

      overflow: hidden

      height: 0

      width: 100%

      padding-bottom: 100%

      .gallary-img

        width: 100%

</style>


写回答

1回答

慕的地2446357

提问者

2018-06-08

初步看了一下是由于选用的图片宽高不相等导致的,应该如何解决呢?

0
2
慕慕4151726
padding-bottom:55%
2020-03-10
共2条回复

Vue2.5-2.6-3.0开发去哪儿网App 零基础入门到实战

课程紧跟Vue3版本迭代,企业主流版本Vue2+Vue3全掌握

10733 学习 · 8206 问题

查看课程