微信小程序定义swiper组件,其中包含普通view,在设置view背景颜色时,无法显示:
第一种解决办法是去掉.item
swiper-item:nth-child(1){
background-color: lightpink;
}
swiper-item:nth-child(2){
background-color:lightsalmon;
}
swiper-item:nth-child(3){
background-color:lightyellow;
}
第二种解决办法是.item前加空格
swiper-item:nth-child(1) .item{
background-color: lightpink;
}
swiper-item:nth-child(2) .item{
background-color:lightsalmon;
}
swiper-item:nth-child(3) .item{
background-color:lightyellow;
}