使用 Ant Design Vue a-select 获取医生签名 (item.docSign) 并绑定到 planModel.docSignSymptom
如何在保持现有代码不变的情况下额外获取item.docSign并赋值给planModel.docSignSymptom,可以在a-select-option标签内使用template标签,并在其中添加一个隐藏的input元素来存储item.docSign的值。然后,使用v-model将该隐藏的input元素的值绑定到planModel.docSignSymptom。
以下是修改后的代码示例:
<a-select v-model:value='planModel.docNameSymptom' show-search :filter-option='doctorOption' style='width: 300px'>
<a-select-option v-for='item in doctors' :key='item.docPinyin' :value='item.docName'>
<template>
<a-input type='hidden' :value='item.docSign' v-model='planModel.docSignSymptom' />
{{ item.docName }}
</template>
</a-select-option>
</a-select>
这样,当选择医生时,planModel.docSignSymptom将自动更新为对应医生的item.docSign的值。
原文地址: https://www.cveoy.top/t/topic/p68h 著作权归作者所有。请勿转载和采集!