Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

fix: make selectables clearable #572

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions frontend/components/Form/Autocomplete2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
class="w-full input input-bordered"
@change="search = $event.target.value"
/>
<button
v-if="!!value"
type="button"
class="absolute inset-y-0 right-6 flex items-center rounded-r-md px-2 focus:outline-none"
@click="clear"
>
<Icon name="mdi-close" class="w-5 h-5" />
</button>
<ComboboxButton class="absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none">
<Icon name="mdi-chevron-down" class="w-5 h-5" />
</ComboboxButton>
Expand Down Expand Up @@ -86,6 +94,10 @@
multiple: false,
});

function clear() {
emit("update:modelValue", null);
}

const search = ref("");
const value = useVModel(props, "modelValue", emit);

Expand Down