File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
import React , { createContext , useContext } from 'react'
2
- import { isArr , isValid } from '@formily/shared'
2
+ import { isArr , toArr , isValid } from '@formily/shared'
3
3
import { Field } from '@formily/core'
4
4
import { observer , useField } from '@formily/react'
5
5
import { InputProps } from 'antd/lib/input'
@@ -213,9 +213,10 @@ const Cascader: React.FC<CascaderProps> = observer((props) => {
213
213
? props . options
214
214
: [ ]
215
215
const getSelected = ( ) => {
216
+ const val = toArr ( props . value )
216
217
return props . multiple
217
- ? props . value . map ( ( item ) => item [ item . length - 1 ] )
218
- : props . value . slice ( props . value . length - 1 )
218
+ ? val . map ( ( item ) => item [ item . length - 1 ] )
219
+ : val . slice ( props . value . length - 1 )
219
220
}
220
221
const getLabels = ( ) => {
221
222
const selected = getSelected ( )
Original file line number Diff line number Diff line change 1
1
import React , { createContext , useContext } from 'react'
2
- import { isArr , isEmpty , isValid } from '@formily/shared'
2
+ import { isArr , isEmpty , isValid , toArr } from '@formily/shared'
3
3
import { Field } from '@formily/core'
4
4
import { useField , observer } from '@formily/react'
5
5
import { InputProps } from '@alifd/next/lib/input'
@@ -208,7 +208,7 @@ const Cascader: React.FC<CascaderProps> = observer((props) => {
208
208
? props . dataSource
209
209
: [ ]
210
210
const getSelected = ( ) => {
211
- return props . multiple ? props . value : [ props . value ]
211
+ return props . multiple ? toArr ( props . value ) : [ props . value ]
212
212
}
213
213
const getLabels = ( ) => {
214
214
const selected = getSelected ( )
You can’t perform that action at this time.
0 commit comments