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

feat: add extraRenderTag props #662

Closed
wants to merge 1 commit into from
Closed

feat: add extraRenderTag props #662

wants to merge 1 commit into from

Conversation

Dreamerryao
Copy link

#660
ant-design/ant-design#32072
添加 extraRenderTag props,并增加对应example

@vercel
Copy link

vercel bot commented Sep 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/select/HQt6T2KBJUSf5gW3uh69w5iTe2Dw
✅ Preview: https://select-git-fork-dreamerryao-feat-add-ext-769fd3-react-component.vercel.app

@@ -69,6 +73,7 @@ const Test: React.FC = () => {
}}
tokenSeparators={[',']}
tagRender={tagRender}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接复用 tagRender 是不是就行了。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实是可以的,昨天我也权衡了一下,如果是这种方案对原tagRender改动是最小的,复用tagRender会有以下需要修改|考虑的地方
1.我们要新增一个boolean接口extraRender用来告知是否对...+2也进行自定义渲染,
2.在tagRender中原定义接口中只有一个有效参数content
3.我们还要在tagRender的props中添加isExtra?:boolean = false,告知使用者是否为extra tag渲染
因此first pr我选择了对原有tagRender入侵更小,并且让用户使用时也更清晰的方式实现这个功能,也麻烦您在思考之后给我一个您觉得更合理的方案

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afc163 您是怎么想的呢 :)

Copy link
Member

@afc163 afc163 Sep 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我建议直接用 tagRender,直观上这个本应该就对 ... 生效,再添加一个 isMaxTag 的布尔值参数来区分就好。

@Dreamerryao
Copy link
Author

为了版本兼容添加参数 renderExtraTag 指定为true时渲染

This pull request was closed.
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

Successfully merging this pull request may close these issues.

None yet

2 participants