index.wxml
1.1 KB
<view class="van-picker">
<view class="van-picker__toolbar van-hairline--bottom">
<view class="van-picker__cancel" bindtap="onCancel">取消</view>
<view class="van-picker__title">{{ title }}</view>
<view class="van-picker__confirm" bindtap="onConfirm">确定</view>
</view>
<view wx:if="{{ loading }}" class="van-picker__loading">
<van-loading color="#38f"/>
</view>
<picker-view
indicator-style="height: {{ itemHeight }}px;"
style="width: 100%; height: {{ itemHeight * visibleItemCount + 'px' }}"
bindchange="onChange"
value="{{ pickerValue }}"
class="van-picker__columns"
>
<picker-view-column
wx:for="{{ displayColumns }}"
wx:for-item="row"
wx:for-index="rowIndex"
wx:key="rowIndex"
class="van-picker-column"
>
<view
wx:for="{{ row }}"
wx:key="{{ item.code }}"
style="line-height: {{ itemHeight }}px;"
class="van-picker-column__item {{ index === pickerValue[rowIndex] ? 'van-picker-column__item--selected' : '' }}"
>{{ item.name }}</view>
</picker-view-column>
</picker-view>
</view>