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

[Select] keys属性无效 #3089

Closed
mdxiaohu opened this issue Feb 29, 2024 · 2 comments
Closed

[Select] keys属性无效 #3089

mdxiaohu opened this issue Feb 29, 2024 · 2 comments

Comments

@mdxiaohu
Copy link

mdxiaohu commented Feb 29, 2024

tdesign-vue 版本

1.9.0

重现链接

No response

重现步骤

<t-select :options="dataList" v-model="form.ids" filterable
placeholder="请选择数据" :scroll="{ type: 'virtual' }" :popupProps="configTSelect.popupProps"
:multiple="true" :valueDisplay="valueDisplay" :minCollapsedNum="1"
:reserveKeyword="true" :keys="configTSelect.keys">
<template #collapsedItems="{ collapsedSelectedItems, count, onClose }">
	<a-popover trigger="hover"
		:overlayStyle="{zIndex: 9999}">
		<template slot="title">
			<div style="color: #00a870;">
				更多已选数据
			</div>
		</template>
		<template slot="content">
			<t-space direction="vertical" :size="3">
				<a-list class="class-multiple-select-list" :bordered="false"
					:data-source="collapsedSelectedItems">
					<a-list-item slot="renderItem" slot-scope="item, index">
						{{ item.label }}
					</a-list-item>
				</a-list>
			</t-space>
		</template>
		<t-tag v-show="count>0" max-width="56" style="color: #00a870;" :title="count">
			+{{ count }}</t-tag>
	</a-popover>
</template>
</t-select>
configTSelect: {
	popupProps: {
		overlayInnerStyle: (trigger) => ({
			width: `${trigger.offsetWidth}px`
		})
	},
	keys: {
		value: 'id',
		label: 'name'
	}
},
valueDisplay(h, {onClose,displayValue}) {
if (!(displayValue instanceof Array)) return;
return displayValue.map((item, index) => ( 
<TTag key={index}
	closable={true}
	onClose={
		(context) => {
			context.e && context.e.stopPropagation();
			onClose(index);
		}
	}
	maxWidth={90}
	title={item.label}>{item.label}</TTag>
))
}

暂时没有排查出来时哪个属性的问题,导致keys失效。

期望结果

keys设置后,label的值为字段name,value的值为字段id。

实际结果

keys设置后无效,label的值为undefined,value是生效的。

框架版本

Vue(2.6.14)

浏览器版本

谷歌(98.0.4758.9)

系统版本

Windows10

Node版本

15.0.1

补充说明

测试数据随便编一个就好

Copy link
Contributor

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

@mdxiaohu
Copy link
Author

先关闭,我再测一测。

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

1 participant