ant-design / ant-design/x

关于Prompts组件想修改选中样式

Open
#672 2 comments 0 reactions 1 assignee Claimed by @kimteayon View on GitHub
enhancement
Dominant language
TypeScript
Stars
4.8k
Forks
1.2k
Avg merge
3d 3h
Merged PRs (30d)
2

Description

### 重现步骤

为了实现提示词选中功能(类似deepseek或者通义那种联网搜索、深度搜索选中效果),我想给Prompts中的item动态绑定个类名,选中的时候加上isActive,但是目前的classNames中item不支持函数式写法,导致如果添加的话每个item都加上了类名

### 当前行为

`
const senderPromptsItems = computed(() => [
{
key: "1",
label: headerTitle1.value,
icon: (

),
className: selectedPrompts.value.has("1") ? 'prompt-icon first-active' : 'prompt-icon'
},
{
key: "2",
label: headerTitle2.value,
icon: (

),
className: selectedPrompts.value.has("2") ? 'prompt-icon second-active' : 'prompt-icon'
},
]);

{/* 🌟 提示词 */}
{ return `sender-prompts-item-${item.key}` },
}}
items={senderPromptsItems.value}
onItemClick={onPromptsItemClick}
/>`

### 预期行为

选中对应的item才会被加上对应的样式类名

### 上下文

分别选中各提示词效果

### 版本

1.06

### 您在哪些浏览器上遇到了这个问题?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.