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

如何禁止Tag标签自带的关闭动画 #937

Closed
xiao-hai opened this issue Jan 26, 2016 · 5 comments
Closed

如何禁止Tag标签自带的关闭动画 #937

xiao-hai opened this issue Jan 26, 2016 · 5 comments

Comments

@xiao-hai
Copy link

非bug问题
————————————
我有一组tag标签,读取this.state.words(数组)渲染,通过onClose操作state实现删除功能(删除words中指定下标的项)。
本来没什么问题,只是tag标签自带关闭动画,每点一次删除,删掉2个标签(真删除一个,自动关闭一个),造成展示的结果跟state对不上。

@afc163
Copy link
Member

afc163 commented Jan 26, 2016

是否是这样的功能:http://codepen.io/anon/pen/jWzxbV?editors=001

这个例子除了没有动画,没有发现删掉两个标签的问题。楼主看下实现是否相同,或者参照此例给个问题重现吧。

@xiao-hai
Copy link
Author

@afc163 重现例子:http://codepen.io/anon/pen/dGmryR?editors=0011
我发现是由于key不唯一引起的,不知这个情况以后会优化代码还是文档说明一下?

@afc163
Copy link
Member

afc163 commented Jan 27, 2016

保证数组元素的 key 唯一是 React 的基本规则,详见:http://facebook.github.io/react/docs/multiple-components.html#dynamic-children 建议严格遵守,否则会有各种无法预知的问题。

严格的说这和 antd 本身关系不大。

@afc163 afc163 closed this as completed Jan 27, 2016
@xiao-hai
Copy link
Author

@afc163 非常感谢。

@lock
Copy link

lock bot commented May 6, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants