iPhone上偶现奇怪问题,点击新的元素之后旧的元素直接消失,除非重新点击
针对这个问题只需要给不显示下划线的元素也设置一个伪元素就可以解决了,代码示例在最后
wxml
<view class="chg_type">
<view class="chg_item {{type==4?'on':''}}" bindtap="sel_type" data-type="4">全部</view>
<view class="chg_item {{type==0?'on':''}}" bindtap="sel_type" data-type="0">未支付</view>
<view class="chg_item {{type==1?'on':''}}" bindtap="sel_type" data-type="1">待发货</view>
<view class="chg_item {{type==2?'on':''}}" bindtap="sel_type" data-type="2">待收货</view>
<!-- <view class="chg_item {{type==3?'on':''}}" bindtap="sel_type" data-type="3">已完成</view> -->
<view class="chg_item {{type==5?'on':''}}" bindtap="sel_type" data-type="5">待评价</view>
</view>
有问题的wxss样式
.chg_type .chg_item::before {
display: block;
content: '';
height: 6rpx;
background: #f87306;
position: absolute;
bottom: -8rpx;
left: 0;
right: 0;
}
修改之后的
.chg_type .chg_item::before {
display: block;
content: '';
height: 6rpx;
background: transparent;
position: absolute;
bottom: -8rpx;
left: 0;
right: 0;
}
.chg_type .chg_item.on::before {
background: #f87306;
}
只需要将css修改之后就可以解决这个问题