tdesign-vue
tdesign-vue copied to clipboard
[select] 设置了reserveKeyword情况下,远程增量搜索会导致之前的选中项变为空对象
tdesign-vue 版本
1.9.6
重现链接
No response
重现步骤
- 远程搜索后选中值
- 重新搜索另一个值,如果返回的options中没有包含之前已选中的值,那么此时勾选的话就会导致v-model绑定的数据中之前选中的对象全部变为空对象,并且无法回显,比如: [ {}, {}, { "value": 1, "label": "this is label1" } ]
- 此时再次搜索再次勾选就会报错(来源于select.tsx:69):Cannot read properties of undefined (reading 'value') 看了报错源码位置,猜测是空对象导致map出现问题
代码
<t-select
v-model="formData.leaders"
value-type="object"
multiple
filterable
placeholder="请输入搜索"
:options="userOptions"
@search="rUserOptions"
:loading="userLoading"
reserveKeyword
clearable
:onClear="onClearUserOptions"
style="width: 400px; display: inline-block"
/>
期望结果
搜索后返回的options中如果没有之前选中的项,不要将v-model绑定的之前的选中项变为空对象
实际结果
No response
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
No response
补充说明
No response