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组件设置fontSize后工作不正常 #2077

Closed
FPG-Alan opened this issue Mar 19, 2024 · 3 comments
Closed

Comments

@FPG-Alan
Copy link
Contributor

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.4.1

平台

weapp

重现链接

https://github.com/FPG-Alan/nutui-ellipsis-reproduce

重现步骤

渲染一个Ellipsis组件, props如下:

<Ellipsis
   content={content}
   rows="3"
   style={{ fontSize: '20rpx' }}
/>

期望的结果是什么?

显示三行文字, 末尾显示“...”

实际的结果是什么?

初始显示四行文字, 然后每100ms显示的文字减一, 直到两行。

环境信息

No response

其他补充信息

No response

@xiaoyatong
Copy link
Collaborator

xiaoyatong commented Mar 20, 2024

现在如果显示一行,会这样:
image

我是这样理解的:如果字修改小号时,是不是可以让放下更多的字?
多行也有类似问题:
image

辛苦跟进~

@FPG-Alan
Copy link
Contributor Author

这也是因为没有给用于测量宽度的nut-ellipsis-copy正确的font size造成的, 如果把nut-ellipsis-copy显示出来可以看到:
image
此时nut-ellipsis-copy使用的是默认字号, 宽度也是按照默认字号来算的。

如果给nut-ellipsis-copy设置了正确的字号, 显示的是正确的, 因为字号缩小, 此时可以放下更多的字:
image

@xiaoyatong
Copy link
Collaborator

#2078

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

No branches or pull requests

2 participants