index.js
738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import './index.less';
class Select extends React.PureComponent {
handleChange = (e) => {
const {
onChange,
} = this.props;
if (onChange) {
onChange(e);
};
}
render() {
const {
name,
value,
options,
} = this.props;
return (
<div className="wowjoy-select">
<select
name={name}
placeholder="请选择"
className="wowjoy-select__inner"
value={value}
onChange={this.handleChange}>
{options.map((option, index) => {
return <option key={index} value={option}>{option}</option>
})}
</select>
</div>
);
}
}
export default Select;