axp-ui/src/components/FieldSelect.vue

28 lines
594 B
Vue
Raw Normal View History

2023-07-11 10:38:21 +03:00
<script setup lang="ts">
import { computed } from 'vue'
import UiField from './Field.vue'
const props = defineProps<{
2023-07-28 13:10:15 +03:00
modelValue?: string | string[] | number | number[],
multiple?: boolean
2023-07-27 15:36:52 +03:00
options: { text: string, value: any }[]
2023-07-11 10:38:21 +03:00
}>()
const emit = defineEmits<{ (e: 'update:modelValue', v?: any): void }>()
const displayValue = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val)
})
</script>
<template>
2023-07-27 15:36:52 +03:00
<ui-field
tag="select"
class="ui-field-select"
:options="props.options"
2023-07-28 13:10:15 +03:00
:multiple="props.multiple"
2023-07-27 15:36:52 +03:00
v-model="displayValue"
/>
2023-07-11 10:38:21 +03:00
</template>