这是一个用scroll-view里面用view设计的表格,希望第一列能垂直居中,研究了好多天,就是没结果
flex布局的align-items:center;
wxss:
.table{
background: #f0f0f0;
}
.table-head{
padding:20rpx;
display: flex;
justify-content: space-between;
}
.table-items{
background: #fff;
padding:20rpx;
display: flex;
justify-content: space-between;
align-items:center;/*垂直居中*/
text-align: center;
border-bottom:1rpx solid #f0f0f0;
}
wxml:
<view class=‘table’>
<view class=‘table-head’>
<view class=‘table-head-item’>星期</view>
<view class=‘table-head-item’>班级</view>
<view class=‘table-head-item’>节次</view>
</view>
<scroll-view scroll-y style=“height: 200px;” class=‘sv’>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
<view class=‘table-items-item’>科目</view>
</view>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
<view class=‘table-items-item’>科目</view>
</view>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
<view class=‘table-items-item’>科目</view>
</view>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
<view class=‘table-items-item’>科目</view>
</view>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
<view class=‘table-items-item’>科目</view>
</view>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
<view class=‘table-items-item’>科目</view>
</view>
<view class=‘table-items’>
<view class=‘table-items-item’>一</view>
<view class=‘table-items-item’>
<view>语文</view>
<view>三年2班</view>
</view>
</scroll-view>
</view>