merge v0.23.0-rc changes
This commit is contained in:
24
ui/src/components/base/AutocompleteInput.svelte
Normal file
24
ui/src/components/base/AutocompleteInput.svelte
Normal file
@@ -0,0 +1,24 @@
|
||||
<script>
|
||||
import CommonHelper from "@/utils/CommonHelper";
|
||||
|
||||
export let value = "";
|
||||
export let options = []; // [{label: "Option 1", value: "opt1"}, {label: "Option 2", value: "opt2"}, ...]
|
||||
|
||||
const uniqueId = "list_" + CommonHelper.randomString(5);
|
||||
</script>
|
||||
|
||||
<input
|
||||
type={$$restProps.type || "text"}
|
||||
list={uniqueId}
|
||||
{value}
|
||||
on:input={(e) => {
|
||||
value = e.target.value;
|
||||
}}
|
||||
{...$$restProps}
|
||||
/>
|
||||
|
||||
<datalist id={uniqueId}>
|
||||
{#each options as opt}
|
||||
<option value={opt.value}>{opt.label || ""}</option>
|
||||
{/each}
|
||||
</datalist>
|
||||
Reference in New Issue
Block a user