mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
script[setup]: select-dropdown (#18427)
* script[setup]: select-dropdown * Align value type
This commit is contained in:
@@ -18,10 +18,9 @@
|
||||
</v-select>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
<script setup lang="ts">
|
||||
import { i18n } from '@/lang';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
type Option = {
|
||||
text: string;
|
||||
@@ -29,41 +28,22 @@ type Option = {
|
||||
children?: Option[];
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: null,
|
||||
},
|
||||
choices: {
|
||||
type: Array as PropType<Option[]>,
|
||||
default: null,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
allowNone: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => i18n.global.t('select_an_item'),
|
||||
},
|
||||
allowOther: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
emits: ['input'],
|
||||
setup() {
|
||||
const { t } = useI18n();
|
||||
return { t };
|
||||
},
|
||||
});
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value: string | number | null;
|
||||
disabled?: boolean;
|
||||
choices?: Option[];
|
||||
icon?: string;
|
||||
allowNone?: boolean;
|
||||
placeholder?: string;
|
||||
allowOther?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: () => i18n.global.t('select_an_item'),
|
||||
}
|
||||
);
|
||||
|
||||
defineEmits(['input']);
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user