没出现圆点

来源:2-6 Vue项目首页 - 首页轮播图(2)

背上我的小书包

2020-05-24 14:58:36

//按照课程代码,未显示圆点,截图放在另一个问题里
<template>
  <div class="wrapper">
    <swiper :options="swiperOptions">
      <swiper-slide>
        <img class="swiper-img" src="https://imgs.qunarzz.com/sight/p0/1501/f4/f467729126949c3a.water.jpg_1000x520_93c8f0e4.jpg" alt="1">
     </swiper-slide>
      <swiper-slide>
        <img class="swiper-img" src="https://imgs.qunarzz.com/sight/p0/2003/b3/b340a948d28304dda3.img.jpg_710x360_11a1a1dc.jpg" alt="2">
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  data () {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination'
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
  .wrapper
    width: 100%
    overflow: hidden
    height: 0
    padding-bottom: 31.25%
    background: #eee
    .swiper-pagination-bullet-active
      background: #000
    .swiper-img
      width: 100%

</style>


写回答

1回答

好帮手慕星星

2020-05-24

同学你好,是图片高度的问题:

http://img.mukewang.com/climg/5eca3aa509f39b8d11620474.jpg

图片高度超出了wrapper盒子的padding-bottom值。因为圆点是相对于swiper-container盒子进行定位的,而这个盒子高度是由图片高度撑起来的,超出padding-bottom值部分隐藏了,所以看不到小圆点。建议修改圆点相对于wrapper盒子定位

http://img.mukewang.com/climg/5eca3cbe093ade9606800399.jpg

效果

http://img.mukewang.com/climg/5eca3cd309c7d44504460179.jpg

自己测试下,祝学习愉快!

0

0 学习 · 10739 问题

查看课程