<script setup lang="ts">
import { httpCategorylist } from "/@/api/netOrderEnter/netOrderEntry";
import { useVModel } from "@vueuse/core";
import RemoteSelect from "/@/components/RemoteSelect";
import { ref } from "vue";

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

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

const CategoryRef = ref<InstanceType<typeof RemoteSelect> | null>(null);

defineExpose({
  initalData: data => (CategoryRef.value as any).initalData(data)
});
</script>

<template>
  <RemoteSelect
    ref="CategoryRef"
    v-model:value="value"
    is-root
    :api="httpCategorylist"
    style="width: 95%"
    placeholder="商品分类"
    request-prop="search"
    response-label-prop="search"
    response-val-prop="id"
  />
</template>
