老是請(qǐng)問(wèn)我在swiper-item中設(shè)置了padding 超出了父容器100%的寬度 導(dǎo)致swiper顯示異常,請(qǐng)問(wèn)一下這種情況如何解決呢
<template> <view?class="banner-box"> <view?class="banner-bg"> <!--?背景?--> </view> <swiper?class="banner-swiper"? indicator-color="rgba(255,?255,?255,?.5)"? indicator-active-color="#fad3d4"? :indicator-dots="true"? :autoplay="false"? :interval="5000"? :duration="500"> <swiper-item?class="swiper-item"> <img?src="/static/banner/banner_1.png"?alt=""> </swiper-item> <swiper-item?class="swiper-item"> <img?src="/static/banner/banner_2.png"?alt=""> </swiper-item> <swiper-item?class="swiper-item"> <img?src="/static/banner/banner_3.jpg"?alt=""> </swiper-item> </swiper> </view> </template>
<style>
.banner-box{
padding-top:?120rpx;
.banner-bg{
position:?absolute;
top:?0;
width:?100%;
height:?470rpx;
transform:?.5s;
}
.banner-swiper{
width:?100%;
height:?350rpx;
//?box-sizing:?border-box;
.swiper-item{
width:?100%;
height:?100%;
padding:?0?30rpx;
}
image?{
width:?100%;?height:?100%;
border-radius:?15rpx;
}
}
}
</style>



2023-07-19
在子容器 swiper-item中 加一行 box-sizing: border-box; 解決? 之前加到父容器了????