Skip to content

picker-view 选项太多的话,滚动选择数据,选中的项没有居中显示在中线 #5555

Closed
@lixun027

Description

@lixun027

发行方式

App

具体平台

Android

开发环境

Windows

项目创建方式

HBuilderX

依赖版本

uniapp 使用 HBuilderX工具最新版本创建的

问题描述

Image

Image

选中的年月日没有在一条线上

重现步骤

`

<picker-view class="picker-view-box" :indicator-style="'height: 80rpx;'" @change="onChange">


{{ year }} 年



01 月
02 月
03 月


01 日
02 日
03 日



<script setup lang="uts"> const years = [2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027, 2025, 2026, 2027,] const onChange = (e : UniPickerViewChangeEvent) => { console.log("e = ", e) } </script> <style lang="scss" scoped> .test-box { width: 100%; height: 400rpx; // background-color: aquamarine; .picker-view-box { width: 100%; height: 400rpx; box-sizing: border-box; display: flex; .picker-view-column-box { height: 400rpx; // background-color: #ffff00; box-sizing: border-box; .item { height: 80rpx; // border: 10rpx solid red; background-color: #FFE7FF; display: flex; align-items: center; justify-content: center; box-sizing: border-box; .text { line-height: 80rpx; text-align: center; // height: 100%; } } } } } </style>`

期望行为

<picker-view class="picker-view-box" :indicator-style="'height: 80rpx;'" @change="onChange">


{{ year }} 年

css
.item {
height: 80rpx;
}

实际行为

No response

截图或录屏

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions