在设计小程序页面的时候,想要设置滚动页面左右滚动,写了scroll-view的scroll-x,但是还是不能左右滚动。测试很多style样式,最后发现设置了min-width就可以实现滚动。
<scroll-view scroll-x>
<!-- 标题 -->
<view class="title"><view class="th1">编辑按钮</view>
<view class="th1">序号</view>
<view class="th1" wx:if="{{glr_flag}}">创建人</view>
<view class="th1">名字</view>
<view class="th1">生日年月日</view>
<view class="th1">生日</view>
<view class="th2">喜好</view>
<view class="th2">备注</view><!-- --></view>
</scroll-view scroll>
class样式:
.th1{
/* width: 40%; */
justify-content: center;
background: #94aaec;
color: #fff;
/* display: flex; height: 3rem; align-items: center; */
min-width: 160rpx;
border: 2rpx solid rgb(241, 183, 56);
padding: 20rpx 0;
text-align: center;
font-size: 12px;}
效果如下: