12345678910111213141516171819202122232425262728 |
- <script lang="ts" setup>
- import { getDict } from '@/utils/dict'
- interface Props {
- modelValue: any
- type: string
- }
- const props = defineProps<Props>()
- const emits = defineEmits(['update:modelValue'])
- const modelValue = computed({
- get: () => props.modelValue,
- set: value => emits('update:modelValue', value)
- })
- const options = ref<any>([])
- getDict(props.type).then(res => {
- options.value = res
- })
- </script>
- <template>
- <el-select v-model="modelValue">
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
- </el-select>
- </template>
- <style lang="scss" scoped></style>
|