添加 dic 组件,select 和 value text
This commit is contained in:
20
admin-web/src/components/Dictionary/DictionarySelect.js
Normal file
20
admin-web/src/components/Dictionary/DictionarySelect.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Select } from 'antd';
|
||||
|
||||
export default class DictionarySelect extends PureComponent {
|
||||
renderOptions() {
|
||||
const { list } = this.props;
|
||||
return list.map(item => {
|
||||
return (
|
||||
<Select.Option key={item.value} value={item.value}>
|
||||
{item.text}
|
||||
</Select.Option>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const options = this.renderOptions();
|
||||
return <Select {...this.props}>{options}</Select>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user