老师,为什么我的圆点会被挤下来
来源:2-6 Vue项目首页 - 首页轮播图(2)
慕仰7236035
2020-12-20 15:27:51

<template>
<div class="wrapper">
<swiper :options="swiperOption">
<!-- slides -->
<swiper-slide>
<img
class="swiper-img"
src="//img1.qunarzz.com/sight/p0/1511/d2/d2aec2dfc5aa771290.water.jpg_600x330_cbd1e1e9.jpg"
alt="南山滑雪场"
/>
</swiper-slide>
<swiper-slide>
<img
class="swiper-img"
src="//img1.qunarzz.com/sight/p0/1505/f5/f5f45e1a83537bcb.water.jpg_600x330_470f194f.jpg"
alt="圆明园"
/>
</swiper-slide>
<swiper-slide>
<img
class="swiper-img"
src="//img1.qunarzz.com/sight/p0/1409/19/adca619faaab0898245dc4ec482b5722.jpg_600x330_f922b488.jpg"
alt="故宫"
/>
</swiper-slide>
<swiper-slide>
<img
class="swiper-img"
src="//img1.qunarzz.com/sight/p0/1602/92/920e47352552c1c990.water.jpg_600x330_ca603c01.jpg"
alt="天坛公园"
/>
</swiper-slide>
<!-- Optional controls -->
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
</template>
<script>
export default {
name: "HomeSwiper",
data() {
return {
swiperOption: {
pagination: '.swiper-pagination',
},
};
},
};
</script>
<style lang="stylus" scoped>
..wrapper >>> .swiper-pagination-bullet-active{
background : #fff
}
.wrapper {
overflow: hidden;
width: 100%;
height: 0;
padding-bottom: 45%;
background: #eee;
.swiper-img {
width: 100%;
}
}
</style>
这里输入代码,可通过选择【代码语言】突出显示
2回答
同学你好,不是padding-bottom的问题,是图片大小的问题。同学代码中使用的图片比较大(源码中使用的图片比较高度比较小),所以高度超出了轮播图区域,如下:

图片太高,把父容器的高度也撑开了。所以圆点切换按钮参照父容器定位后,也超出了轮播图区域。例如给图片限制高度,圆点就出来了。如下:

当然了,如果想要使用自己的图片,不设置固定高度的时候,可以调整圆点的位置,如下:

祝学习愉快~
慕仰7236035
提问者
2020-12-20
好像是我这里的问题
相似问题