@@ -4,7 +4,7 @@ import Select, { AbstractSelectProps, SelectValue } from '../select'
4
4
import Input from '../input'
5
5
import InputElement from './InputElement'
6
6
import 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'
8
8
9
9
const DataSourceItemObject = PropTypes . shape ( {
10
10
value : String ,
@@ -24,7 +24,7 @@ const AutoCompleteProps = {
24
24
...AbstractSelectProps ,
25
25
value : SelectValue ,
26
26
defaultValue : SelectValue ,
27
- dataSource : PropTypes . arrayOf ( DataSourceItemType ) ,
27
+ dataSource : PropTypes . array ,
28
28
optionLabelProp : String ,
29
29
dropdownMatchSelectWidth : PropTypes . bool ,
30
30
// onChange?: (value: SelectValue) => void;
@@ -57,6 +57,13 @@ export default {
57
57
const { $slots } = this
58
58
const children = filterEmpty ( $slots . default )
59
59
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
+ }
60
67
return (
61
68
< InputElement > { element } </ InputElement >
62
69
)
@@ -97,6 +104,9 @@ export default {
97
104
options = childArray
98
105
} else {
99
106
options = dataSource ? dataSource . map ( ( item ) => {
107
+ if ( isValidElement ( item ) ) {
108
+ return item
109
+ }
100
110
switch ( typeof item ) {
101
111
case 'string' :
102
112
return < Option key = { item } > { item } </ Option >
0 commit comments