//html代码片段
<scroll-view scroll-x :scrollLeft="scrollLeft" @scroll="scroll" class="right-head" style="white-space: nowrap">
<view class="table-header-item" >库销比</view>
<view class="table-header-item" >动销率</view>
<view class="table-header-item" >售罄率</view>
</scroll-view>
<script>
</script>
scroll(e){
this.scrollLeft = e.detail.scrollLeft;
},
<style>
.table-header-item{
min-width: 150upx;
text-align: center;
color: $font-color-dark;
font-size: 28upx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: bold;
display: inline-block;
}
</style>
scroll-view 样式 style="white-space: nowrap"
view样式 display: inline-block;
这样就会保持一行了