Skip to content

Commit acdd7e5

Browse files
authored
Fix 652 (#656)
* fix: #654 * fix: #652
1 parent 68e9b54 commit acdd7e5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/react-vant/src/components/picker/PickerColumn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

packages/react-vant/src/components/picker/columnsExtend.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ type KeysProps = {
1616
function 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') {

0 commit comments

Comments
 (0)