收藏
回答

请教一下为什么cell-value无法垂直居中?

      <mp-cell title="聚餐时间" link bindtap="openDateTimePicker">
        <view slot="footer" class="cell-footer">
          <text class="cell-value">
            {{mealDate && mealTime ? mealDate + ' ' + mealTime : '请选择日期和时间'}}
          </text>
        </view>
      </mp-cell>

/* 单元格值样式 */
.cell-value {
  font-size: 28rpx;
  color: #666666;
  text-align: center;
  min-height: 60rpx; /* 修改为 min-height */
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 200rpx;
}
.cell-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 100%; /* 修改为 min-height */
  min-height: 60rpx;
}
回答关注问题邀请回答
收藏

1 个回答

  • 一笑皆春
    一笑皆春
    2025-06-24

    你的.cell-footer的justify-content: flex-end;得设置center吧

    2025-06-24
    有用
    回复 2
    • OMD
      OMD
      发表于移动端
      2025-06-24
      嗯嗯,有试过改成center,但也不能垂直居中
      2025-06-24
      回复
    • 一笑皆春
      一笑皆春
      2025-06-24回复OMD
      text改成View
      2025-06-24
      回复
登录 后发表内容