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

Badge content属性无效问题 #3263

Closed
mateow1192 opened this issue Aug 6, 2024 · 4 comments
Closed

Badge content属性无效问题 #3263

mateow1192 opened this issue Aug 6, 2024 · 4 comments
Labels
🐞 bug Something isn't working to be published fixed, not be published

Comments

@mateow1192
Copy link

mateow1192 commented Aug 6, 2024

tdesign-vue 版本

latest

重现链接

Not necessary

重现步骤

设置content为new但是不会显示

<t-badge content="new">
    <t-button>按钮</t-button>
</t-badge>

期望结果

Badge组件正常显示content内容

实际结果

Badge组件不显示content内容

框架版本

Vue(~2.6.14)

浏览器版本

无需

系统版本

无需

Node版本

20+

补充说明

文档里写了是有content这个prop的:
https://tdesign.tencent.com/vue/components/badge?tab=api
但是源码实现并没有用到this.content这个prop
如果没用的话其实可以删掉文档里的描述
但是只用count这个属性的话又有迷惑性,会让人以为count一定是个数值啥的 ( 其实不是 )
所以content这个属性要不要留呢?留的话它和count的优先级怎么处理? (corner case: 两个属性同时出现)
可以提供PR

Copy link
Contributor

github-actions bot commented Aug 6, 2024

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

@uyarn uyarn added the 🐞 bug Something isn't working label Aug 28, 2024
@uyarn
Copy link
Collaborator

uyarn commented Aug 28, 2024

您好,是实现遗漏,需要实现的。
不过这个和count的作用不是一个,而是和默认插槽一个作用,主要是保持各个框架API的一致性的考虑。
如果您有兴趣实现,可以在 https://github.com/Tencent/tdesign-vue/blob/develop/src/badge/badge.tsx 中做如下修改即可

  1. import { renderContent } from '../utils/render-tnode'; 这个是公共的用于支持多类型渲染的API的函数
  2. 修改https://github.com/Tencent/tdesign-vue/blob/develop/src/badge/badge.tsx#L50 const children = renderContent(this, 'default', 'content'); 即可

@uyarn
Copy link
Collaborator

uyarn commented Aug 28, 2024

image

@uyarn uyarn added the to be published fixed, not be published label Aug 28, 2024
@uyarn uyarn mentioned this issue Aug 29, 2024
16 tasks
@uyarn
Copy link
Collaborator

uyarn commented Aug 29, 2024

published 1.10.0

@uyarn uyarn closed this as completed Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working to be published fixed, not be published
Projects
None yet
Development

No branches or pull requests

2 participants