Skip to content

Commit face547

Browse files
committed
fix #1301
1 parent ba71655 commit face547

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Editor.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ const editor = function(editable, attr, format, editorClass, defaultValue, ignor
3737
let options = [];
3838
const values = editable.options.values;
3939
if (Array.isArray(values)) {// only can use arrray data for options
40-
let rowValue;
41-
options = values.map((d, i) => {
42-
rowValue = format ? format(d) : d;
40+
let text;
41+
let value;
42+
options = values.map((option, i) => {
43+
if (typeof option === 'object') {
44+
text = option.text;
45+
value = option.value;
46+
} else {
47+
text = format ? format(option) : option;
48+
value = option;
49+
}
4350
return (
44-
<option key={ 'option' + i } value={ d }>{ rowValue }</option>
51+
<option key={ 'option' + i } value={ value }>{ text }</option>
4552
);
4653
});
4754
}

0 commit comments

Comments
 (0)