mirror of
https://github.com/wassname/talk.git
synced 2026-07-11 11:09:18 +08:00
render label
This commit is contained in:
@@ -68,11 +68,11 @@ class Dropdown extends React.Component {
|
||||
renderLabel() {
|
||||
const options = React.Children.toArray(this.props.children);
|
||||
const option = options.find((option) => option.props.value === this.props.value);
|
||||
|
||||
if (option.props.label) {
|
||||
return option.props.label;
|
||||
} else if(option.props.value) {
|
||||
return option.props.value;
|
||||
|
||||
if (option) {
|
||||
return option.props.label ? option.props.label : option.props.value;
|
||||
} else if (this.props.value) {
|
||||
return this.props.value;
|
||||
} else {
|
||||
return this.props.placeholder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user