<PickerView
className='pk-picker__view'
indicator-class='pk-picker__current'
onChange={e => {
if (onColumnChange) {
onColumnChange(e.detail.value);
}
}}
value={value}
>
<PickerViewColumn>
{range.map((item, idx) => (
<View key={`${idx}${item}`} className='pk-picker__item'>
{typeof item === 'function'
? item()
: rangeKey
? item[rangeKey]
: item}
</View>
))}
</PickerViewColumn>
</PickerView>
//初始值
this.state = {
range: [1, 2, 3],
val: [1],
}
this.setState({
range: [1, 2, 3, 4]
val: [3]
})
你试试先修改range 再指定value呢,在回调里进行