jdcProject_front/src/pages/composable-demo/use-fetch-select.vue

21 lines
851 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script lang="ts" setup>
import { useFetchSelect } from "@/composables/useFetchSelect"
import { getSelectDataApi } from "@/http/composable-demo/use-fetch-select"
const { loading, options, value } = useFetchSelect({
api: getSelectDataApi
})
</script>
<template>
<div class="app-container">
<h4>该示例是演示通过 composable 自动调用 api 后拿到 Select 组件需要的数据并传递给 Select 组件</h4>
<h5>Select 示例</h5>
<el-select v-model="value" :loading="loading" filterable>
<el-option v-for="(item, index) in options" v-bind="item" :key="index" placeholder="请选择" />
</el-select>
<h5>Select V2 示例如果数据量过多可以选择该组件</h5>
<el-select-v2 v-model="value" :loading="loading" :options="options" filterable placeholder="请选择" />
</div>
</template>