File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
components/vc-select/utils Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11import { warning } from '../../vc-util/warning' ;
2- import { isVNode , VNodeChild } from 'vue' ;
2+ import { cloneVNode , isVNode , VNodeChild } from 'vue' ;
33import {
44 OptionsType as SelectOptionsType ,
55 OptionData ,
@@ -151,7 +151,13 @@ export const getLabeledValue: GetLabeledValue<FlattenOptionData[]> = (
151151 warning ( false , '`label` of `value` is not same as `label` in Select options.' ) ;
152152 }
153153 } 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+ }
155161 } else {
156162 result . label = value ;
157163 }
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ function warningProps(props: SelectProps) {
8989 warning (
9090 ! labelInValue ||
9191 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`' ,
9393 ) ;
9494
9595 warning (
You can’t perform that action at this time.
0 commit comments