<template>

  <el-select
    v-model="selected"
    :teleported="false"
    :options
  >
    <el-option
      v-for="({ id, label, value }) in options"
      :key="id"
      v-bind="{ label, value }"
    />
  </el-select>

</template>

<script lang='ts' setup>

import { getDictDataPage } from '@/api/system/dict/dict.data.ts'

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

const options = ref([])
const selected = defineModel()

onBeforeMount(async () => {

  const { list } = await getDictDataPage({ dictType: props.code })
  options.value = list

})

</script>

<style lang='scss' scoped>

</style>