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

文本省略组件存在失效bug #6748

Closed
Wu-hj opened this issue Sep 28, 2024 · 1 comment · Fixed by #6771
Closed

文本省略组件存在失效bug #6748

Wu-hj opened this issue Sep 28, 2024 · 1 comment · Fixed by #6771

Comments

@Wu-hj
Copy link

Wu-hj commented Sep 28, 2024

Version of antd-mobile

5.37.1

Operating system and its version

Others

Browser and its version

No response

Sandbox to reproduce

https://stackblitz.com/edit/antd-mobile-r2huqf?file=index.tsx

What happened?

当传入的content为中文时文本省略生效,当传入的content为英文单词或者字符串类型的数字文本时,文本省略失效

Relevant log output

No response

@2020191543223
Copy link

2020191543223 commented Oct 8, 2024

Ellipsis 组件内部会读取 word-break 这个 CSS 属性的值,如果未设置该样式属性的值,默认值为:normal。所以,当文本内容中包含大量数字或英文时,文本内容无法省略(浏览器的默认行为)。此时,如果需要让文本省略生效,可以手动在 Ellipsis 组件或其外层元素中,添加 word-break 样式(比如,word-break: break-word),Ellipsis 组件会完全遵循样式继承行为,拿到你设置的 word-break,从而实现自动省略。
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants