File tree 2 files changed +9
-3
lines changed
components/vc-select/utils
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { warning } from '../../vc-util/warning' ;
2
- import { isVNode , VNodeChild } from 'vue' ;
2
+ import { cloneVNode , isVNode , VNodeChild } from 'vue' ;
3
3
import {
4
4
OptionsType as SelectOptionsType ,
5
5
OptionData ,
@@ -151,7 +151,13 @@ export const getLabeledValue: GetLabeledValue<FlattenOptionData[]> = (
151
151
warning ( false , '`label` of `value` is not same as `label` in Select options.' ) ;
152
152
}
153
153
} else if ( item && optionLabelProp in item ) {
154
- result . label = item [ optionLabelProp ] ;
154
+ if ( Array . isArray ( item [ optionLabelProp ] ) ) {
155
+ result . label = isVNode ( item [ optionLabelProp ] [ 0 ] )
156
+ ? cloneVNode ( item [ optionLabelProp ] [ 0 ] )
157
+ : item [ optionLabelProp ] ;
158
+ } else {
159
+ result . label = item [ optionLabelProp ] ;
160
+ }
155
161
} else {
156
162
result . label = value ;
157
163
}
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ function warningProps(props: SelectProps) {
89
89
warning (
90
90
! labelInValue ||
91
91
values . every ( val => typeof val === 'object' && ( 'key' in val || 'value' in val ) ) ,
92
- '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`' ,
92
+ '`value` should in shape of `{ value: string | number, label?: any }` when you set `labelInValue` to `true`' ,
93
93
) ;
94
94
95
95
warning (
You can’t perform that action at this time.
0 commit comments