@@ -4,7 +4,7 @@ import Select, { AbstractSelectProps, SelectValue } from '../select'
44import Input from '../input'
55import InputElement from './InputElement'
66import PropTypes from '../_util/vue-types'
7- import { getComponentFromProp , getOptionProps , filterEmpty } from '../_util/props-util'
7+ import { getComponentFromProp , getOptionProps , filterEmpty , isValidElement , getEvents , getStyle , getClass } from '../_util/props-util'
88
99const DataSourceItemObject = PropTypes . shape ( {
1010 value : String ,
@@ -24,7 +24,7 @@ const AutoCompleteProps = {
2424 ...AbstractSelectProps ,
2525 value : SelectValue ,
2626 defaultValue : SelectValue ,
27- dataSource : PropTypes . arrayOf ( DataSourceItemType ) ,
27+ dataSource : PropTypes . array ,
2828 optionLabelProp : String ,
2929 dropdownMatchSelectWidth : PropTypes . bool ,
3030 // onChange?: (value: SelectValue) => void;
@@ -57,6 +57,13 @@ export default {
5757 const { $slots } = this
5858 const children = filterEmpty ( $slots . default )
5959 const element = children . length ? children [ 0 ] : < Input />
60+ console . log ( element )
61+ const eleProps = {
62+ props : getOptionProps ( element ) ,
63+ on : getEvents ( element ) ,
64+ style : getStyle ( element ) ,
65+ class : getClass ( element ) ,
66+ }
6067 return (
6168 < InputElement > { element } </ InputElement >
6269 )
@@ -97,6 +104,9 @@ export default {
97104 options = childArray
98105 } else {
99106 options = dataSource ? dataSource . map ( ( item ) => {
107+ if ( isValidElement ( item ) ) {
108+ return item
109+ }
100110 switch ( typeof item ) {
101111 case 'string' :
102112 return < Option key = { item } > { item } </ Option >
0 commit comments