picker-view-column indicator-style设置高度无效?
发布于 5 年前 作者 guiying32 2923 次浏览 来自 问答
<picker-view indicator-style="height: 34px;" class="_picker-view data-v-76be9f4c u-picker" bindchange="handleProxy" value="{{initId}}" data-eventid="{{'3'}}" data-comkey="{{$k}}">
  <picker-view-column class="_picker-view-column data-v-76be9f4c">
    <block wx:key="index" key="{{index}}" wx:for="{{params.value}}" wx:for-index="index" wx:for-item="item">
      <view class="_div data-v-76be9f4c u-item" style=" {{('color:' + (index === selectedId ? params.color : '#666') + ';')}}">{{item.name}}
      </view>
    </block>
  </picker-view-column>
</picker-view>
...
...
.u-picker {
  width: 100%;
  height: 300px;

  .u-item {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 34px;
    font-size: 16px;
  }
}

在iphone 6/7/8 中默认为34px iphone XS 中默认为37px

picker-view 中设置属性indicator-style=34px 没有效果


这样导致在不同机型中因选中框高度不统一,各子view高度无法统一导致样式异常


这个怎么解决呢?

2 回复

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

加个行高试试

回到顶部