Skip to content

Commit 8656610

Browse files
fix: #181 MultiSelect can now be cleared manually.
1 parent ab48f55 commit 8656610

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

frontend/components/Form/Multiselect.vue

+14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
<span v-for="itm in value" :key="name != '' ? itm[name] : itm" class="badge">
99
{{ name != "" ? itm[name] : itm }}
1010
</span>
11+
<button
12+
v-if="value.length > 0"
13+
type="button"
14+
class="absolute inset-y-0 right-6 flex items-center rounded-r-md px-2 focus:outline-none"
15+
@click="clear"
16+
>
17+
<MdiClose class="size-5" />
18+
</button>
1119
</div>
1220
<div
1321
tabindex="0"
@@ -36,6 +44,8 @@
3644
</template>
3745

3846
<script lang="ts" setup>
47+
import MdiClose from "~icons/mdi/close";
48+
3949
const emit = defineEmits(["update:modelValue"]);
4050
const props = defineProps({
4151
label: {
@@ -78,6 +88,10 @@
7888
});
7989
});
8090
91+
function clear() {
92+
value.value = [];
93+
}
94+
8195
const selected = computed<string[]>(() => {
8296
return value.value.map(itm => itm[props.uniqueField]);
8397
});

0 commit comments

Comments
 (0)