<script setup lang="ts">
import { httpPlatformlist } from "/@/api/netOrderEnter/netOrderEntry";
import { useVModel } from "@vueuse/core";
import { watch } from "vue";
import { useAsync } from "/@/hooks/core/useAsync";

const props = defineProps<{
  modelValue: string;
  visible: boolean
}>();

const value = useVModel(props, "modelValue");

const {
  data: options,
  run,
  loading
} = useAsync<Array<any>>({
  initalData: []
});

watch(
  () => props.visible,
  () => {
    run(httpPlatformlist({}));
  },
  {
    immediate: true
  }
);
</script>

<template>
  <el-select filterable v-model="value" :loading="loading" style="width:100%">
    <el-option
      v-for="opt in options"
      :label="opt.platform_name"
      :key="opt.id"
      :value="opt.id"
    />
  </el-select>
</template>
