updates
This commit is contained in:
@@ -10,19 +10,18 @@ export class AppendOptions {
|
||||
this.replaceChildren();
|
||||
}
|
||||
|
||||
if (Ut.isStr(data)) {
|
||||
|
||||
let options = '';
|
||||
|
||||
if (Ut.isStr(data)) {
|
||||
|
||||
data.replace(/"((?:\\.|[^"\\])*)"\s*:\s*"((?:\\.|[^"\\])*)"/g,
|
||||
(_, k, v) => (options += `<option value="${JSON.parse(`"${k}"`)}">${JSON.parse(`"${v}"`)}</option>`, '')
|
||||
);
|
||||
}
|
||||
else {
|
||||
Ut.each(data, (v, k) => options += `<option value="${k}">${v}`);
|
||||
}
|
||||
|
||||
target.innerHTML = options;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Ut.each(data, (val, id) => target.append(new Option(val, id)) );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user