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

Ellipsis组件文本为汉字时,设置length时有bug #1557

Closed
DuduStyle opened this issue May 29, 2018 · 3 comments · Fixed by #1592
Closed

Ellipsis组件文本为汉字时,设置length时有bug #1557

DuduStyle opened this issue May 29, 2018 · 3 comments · Fixed by #1592
Assignees

Comments

@DuduStyle
Copy link

DuduStyle commented May 29, 2018

假设此时article为“曲盈盈”
如果人名超过2个字,即显示为(曲...),代码如下
<Ellipsis length={2}>{article}</Ellipsis>
显示的实际效果为"..."

重现地址:

https://codesandbox.io/s/p2wj89wr0

@ant-design-bot
Copy link

Translation of this issue:


When ## Ellipsis component text is Chinese, there is a bug in setting length

@nikogu
Copy link
Contributor

nikogu commented May 30, 2018

https://github.com/ant-design/ant-design-pro/blob/master/src/components/Ellipsis/index.js#L19

应该是 length 把 ... 算上了,这个后面要改下,所以现在得每个加 3 个字符,比如 2 + 3 =5...

@DuduStyle
Copy link
Author

明白了,那这样的话我字符的长度就必须要达到5,才能实现曲...这样的效果;

const article = "曲盈盈12";
<Ellipsis length={4}>{article}</Ellipsis>

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 a pull request may close this issue.

3 participants