index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <div :style="{ width: item.width ? item.width + 'px' : '100%' }">
  3. <v-autocomplete
  4. v-model="value"
  5. :rules="item.rules"
  6. :attach="!item.noAttach"
  7. :loading="item.loading"
  8. :label="item.label"
  9. :placeholder="item.placeholder || item.label"
  10. :item-title="item.itemText || 'label'"
  11. :item-value="item.itemValue || 'value'"
  12. :items="item.items"
  13. variant="outlined"
  14. :density="item.dense || 'compact'"
  15. :append-to-body="true"
  16. :disabled="item.disabled"
  17. :multiple="item.multiple"
  18. :clearable="item.clearable"
  19. :search="item.searchInput"
  20. :hide-no-data="item.hideNoData"
  21. :no-data-text="item.noDataText || 'No data available'"
  22. :hide-selected="item.hideSelected"
  23. ></v-autocomplete>
  24. </div>
  25. </template>
  26. <script setup>
  27. import { computed, defineEmits } from 'vue';
  28. defineOptions({ name:'FormUI-v-autocomplete'})
  29. const props = defineProps({item: Object, modelValue: [String, Number]})
  30. const emit = defineEmits(['update:modelValue'])
  31. const item = props.item
  32. const value = computed({
  33. get() { return props.modelValue },
  34. set(value) { emit('update:modelValue', value) }
  35. })
  36. </script>
  37. <style lang="scss" scoped>
  38. </style>