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,10 +22,15 @@ export class StringValueParser extends BaseValueParser {
const map = new Map(); const map = new Map();
const set = new Set(); const set = new Set();
for (const option of options) { for (const option of options) {
if (typeof option === 'string') {
set.add(option);
map.set(option, option);
} else {
set.add(option.value); set.add(option.value);
set.add(option.label); set.add(option.label);
map.set(option.label, option.value); map.set(option.label, option.value);
} }
}
return { map, set }; return { map, set };
} }
} }