picker-view重新渲染如果列数不同,默认选项会显示错误
发布于 6 年前 作者 cxie 8224 次浏览 来自 问答

在同一个页面中有两个选项需要用到picker-view。其中一个是1列选项,另一个是2列选项,在切换显示的过程中,如果从2列切换成1列显示,则无法显示为默认的选项。

2 回复
<view hidden="{{sel_hidden}}">
<view class="cal-num_disable"></view>
    <view class="weui-footer weui-footer_fixed-bottom">
        <view class="weui-form-preview__ft cal-num_picker_ok">
            <button class="weui-form-preview__btn weui-form-preview__btn_default" hover-class="weui-form-preview__btn_active" bindtap="cancelSel" hover-stay-time="50">取消</button> <button class="weui-form-preview__btn weui-form-preview__btn_primary" hover-class="weui-form-preview__btn_active" bindtap="selModel" hover-stay-time="50">确认</button>
        </view>
        <picker-view indicator-style="height: 50px;" class="cal-num_model_sel" style="width: 100%; height: 450rpx;font-size:40rpx;" value="{{pValue}}" bindchange="pickerChange">
            <block wx:for="{{fModel.cols}}" wx:for-item="options">
            <picker-view-column>
                <view wx:for="{{options}}" wx:for-item="option" style="line-height: 50px">{{option.name}}</view>
            </picker-view-column>
            </block>
        </picker-view>
    </view>
 
</view>

提供一下代码?

回到顶部