mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
2e08ad8c17
commit
bf39529f41
7 changed files with 54 additions and 38 deletions
11
app/src/util/genOptions.ts
Normal file
11
app/src/util/genOptions.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export const genOptions = (data: string[] | { label: string, name: string }[], key: string) => {
|
||||
let html = "";
|
||||
data.forEach((item: string | { label: string, name: string }) => {
|
||||
if (typeof item === "string") {
|
||||
html += `<option value="${item}" ${key === item ? "selected" : ""}>${item}</option>`;
|
||||
} else {
|
||||
html += `<option value="${item.name}" ${key === item.name ? "selected" : ""}>${item.label}</option>`;
|
||||
}
|
||||
});
|
||||
return html;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue