fix(value-parser): option type is string

This commit is contained in:
chenos 2023-07-14 18:56:58 +08:00
parent 5540a582f0
commit f87cf982f1

View File

@ -22,9 +22,14 @@ export class StringValueParser extends BaseValueParser {
const map = new Map();
const set = new Set();
for (const option of options) {
set.add(option.value);
set.add(option.label);
map.set(option.label, option.value);
if (typeof option === 'string') {
set.add(option);
map.set(option, option);
} else {
set.add(option.value);
set.add(option.label);
map.set(option.label, option.value);
}
}
return { map, set };
}