File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
packages/react-vant/src/components/picker Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ const PickerColumn = memo<
9898 index = adjustIndex ( index ) || 0
9999 const offset = - index * props . itemHeight
100100 const trigger = ( ) => {
101- if ( options [ index ] [ valueKey ] !== value ) {
101+ if ( options [ index ] ?. [ valueKey ] !== value ) {
102102 onSelect ( options [ index ] )
103103 }
104104 }
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ type KeysProps = {
1616function useColumnsFn ( options : PickerProps [ 'columns' ] , keys : KeysProps ) {
1717 const { textKey, valueKey, childrenKey } = keys
1818 const dataType = useMemo ( ( ) => {
19+ const isCascade = options . some (
20+ el => typeof el === 'object' && childrenKey in el
21+ )
22+ if ( isCascade ) return 'cascade'
1923 const firstColumn = options [ 0 ] || { }
2024
2125 if ( typeof firstColumn === 'object' ) {
You can’t perform that action at this time.
0 commit comments