mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
70 lines
1.2 KiB
Vue
70 lines
1.2 KiB
Vue
<template>
|
|
<v-notice v-if="!choices" type="warning">
|
|
{{ t('choices_option_configured_incorrectly') }}
|
|
</v-notice>
|
|
<v-select
|
|
v-else
|
|
multiple
|
|
:model-value="value"
|
|
:items="choices"
|
|
:disabled="disabled"
|
|
:show-deselect="allowNone"
|
|
:placeholder="placeholder"
|
|
:allow-other="allowOther"
|
|
:close-on-content-click="false"
|
|
@update:model-value="$emit('input', $event)"
|
|
>
|
|
<template v-if="icon" #prepend>
|
|
<v-icon :name="icon" />
|
|
</template>
|
|
</v-select>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { useI18n } from 'vue-i18n';
|
|
import { defineComponent, PropType } from 'vue';
|
|
|
|
type Option = {
|
|
text: string;
|
|
value: string | number | boolean;
|
|
};
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
value: {
|
|
type: Array as PropType<string[]>,
|
|
default: null,
|
|
},
|
|
choices: {
|
|
type: Array as PropType<Option[]>,
|
|
default: null,
|
|
},
|
|
icon: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
allowNone: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
placeholder: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
allowOther: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
emits: ['input'],
|
|
setup() {
|
|
const { t } = useI18n();
|
|
return { t };
|
|
},
|
|
});
|
|
</script>
|