Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TSelect] 明明有数据,但是select组件的下拉菜单就是不显示 #854

Closed
arieslee opened this issue May 23, 2022 · 2 comments
Closed

Comments

@arieslee
Copy link

tdesign-vue-next 版本

0.14.2

重现链接

https://stackblitz.com/edit/angular-peryga?file=src/demo.vue

重现步骤

<template>
    <div class="icd-remote">
        <t-select v-model="data" filterable placeholder="请输入搜索" :keys="{ value: 'code', label: 'title' }" :options="options" :loading="loading" @change="onChange" reserve-keyword @search="remoteMethod" />
    </div>
</template>

<script setup lang="ts">
import { ref, toRefs } from 'vue';
import { IApiResponse } from '@/utils/types';
import { searchIcdList } from '@/api/icd';

const loading = ref(false);
const options = ref([]);
const props = defineProps({
    data: {
        type: String,
        default() {
            return null;
        },
    },
});
const { data } = toRefs(props);
const emit = defineEmits(['update:data']);
const remoteMethod = async (search) => {
    try {
        loading.value = true;
        const res: IApiResponse = await searchIcdList({ kw: search });
        if (res.code === 0) {
            options.value = res.data.data_list;
        } else {
            return Promise.reject(new Error(res.message));
        }
    } catch (e) {
        console.log(e);
    } finally {
        loading.value = false;
    }
};
const onChange = (v) => {
    emit('update:data', v);
};
</script>

searchIdcList的返回结果

{
    "code": 0,
    "message": "",
    "data": {
        "data_list": [
            {
                "id": 288946540875799,
                "code": "E22.002",
                "title": "生长激素生成过多",
                "help_code": "SZJSSCGD"
            },
            {
                "id": 288946540826662,
                "code": "E54  02",
                "title": "维生素C缺乏(抗坏血酸缺乏)",
                "help_code": "WSSCQFKHXSQF"
            },
            {
                "id": 288946540818464,
                "code": "E24.002",
                "title": "促肾上腺皮质激素生成过多",
                "help_code": "CSSXPZJSSCGD"
            },
            {
                "id": 288946540699693,
                "code": "M8833/3",
                "title": "色素沉着性隆凸性皮肤纤维肉瘤",
                "help_code": "SSCZXLTXPF"
            },
            {
                "id": 288946540613681,
                "code": "T81.017",
                "title": "手术操作后创面出血",
                "help_code": "SSCZHCMCX"
            },
            {
                "id": 288946540613639,
                "code": "T79.101",
                "title": "脂肪拴塞(创伤性)",
                "help_code": "ZFSSCSX"
            },
            {
                "id": 288946540441608,
                "code": "Q20.101",
                "title": "先天性右心室双出口",
                "help_code": "XTXYXSSCK"
            },
            {
                "id": 288946540371979,
                "code": "Q85.801",
                "title": "普-杰二氏综合征(遗传性色素沉着消化",
                "help_code": "PJESZHZYCXSSC"
            },
            {
                "id": 288946540306459,
                "code": "L81.901",
                "title": "皮肤色素沉着",
                "help_code": "PFSSCZ"
            },
            {
                "id": 288946540249096,
                "code": "H20.803",
                "title": "眼色素层脑膜炎",
                "help_code": "YSSCNMY"
            },
            {
                "id": 288946540216326,
                "code": "G60.803",
                "title": "色素沉着,水肿,多发性神经病综合征",
                "help_code": "SSCZSZDFXSJB"
            }
        ]
    }
}

期望结果

显示下拉菜单项

实际结果

168774645-0d2752dd-be16-47d1-a473-1d843e9926c2

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

v14.19.1

补充说明

No response

@github-actions
Copy link
Contributor

👋 @arieslee,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@PengYYYYY
Copy link
Collaborator

#799 到这边沟通喔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants