如何知道material-ui TextField是否被截断
我已经为我的 TextField mui 组件指定了自定义样式,如下所示:
'& > * .MuiFilledInput-input': {
overflow: 'hidden',
textOverflow: 'ellipsis',
},
这是为了在 TextField 内截断文本时显示省略号。这工作正常,但现在我需要仅在文本被截断时显示工具提示。因此,我需要找出上面的样式是否使用了 TextField 或者文本是否被截断。我不想使用硬编码的长度/宽度方法,而是动态查找它。有什么想法如何去做吗?
I have given a custom styling to my TextField mui component like below:
'& > * .MuiFilledInput-input': {
overflow: 'hidden',
textOverflow: 'ellipsis',
},
This is to show the ellipsis when the text is truncated inside TextField. This works fine but now I need to show a tooltip only when the text is truncated. So somehow I need to find out if the TextField used above styling or if the text was truncated. I do not want to use hard-coded length/width approach but instead find it out dynamically. Any ideas how to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论