<template>
    <el-select v-model="formData[model]" class="flex-1 w-[280px]">
        <el-option v-for="(item, index) in list" :key="index" :label="item[lable]" :value="item[value]" />
    </el-select>

</template>
<script lang="ts" setup>
import { ref, defineProps, onMounted } from "vue"

const props = defineProps({
    formData: {
        require: true,
        type: Object
    },
    model: String,
    api: Function,
    lable: {
        type: String,
        default: 'projectinfo'
    },
    value: {
        type: String,
        default: 'id'
    },
    query: {
        type: Object,
        default: {}
    }
})

const list = ref("")

onMounted(() => {
    if (!props.api) return
    props.api(props.query).then(res => {
        list.value = res
    })



})




</script>