next/components/story/atoms/genre.vue

20 lines
670 B
Vue
Raw Normal View History

<script lang="ts" setup>
import { useField } from "vee-validate";
const fname = inject<string>("curName");
let { data: data } = await useApiFetch("/genres");
let opts = (data.value as unknown as any[]).map((a) => ({
value: a,
label: a,
}));
2023-12-29 20:53:29 -05:00
const { value, errorMessage, name, setValue } = useField<string[]>(fname + "genre");
</script>
<template>
2023-12-29 20:53:29 -05:00
<a-form-item :help="errorMessage" label="Genre(s)" :validate-status="!!errorMessage ? 'error' : undefined">
<a-select :allow-clear="true" :options="opts" v-model:value="value" mode="multiple">
<template #removeIcon>
<i class="far fa-circle-x" />
</template>
</a-select>
</a-form-item>
</template>