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

extEllipsis 文本省略 #5536

Closed
lilin87788 opened this issue Aug 30, 2023 · 2 comments
Closed

extEllipsis 文本省略 #5536

lilin87788 opened this issue Aug 30, 2023 · 2 comments

Comments

@lilin87788
Copy link

lilin87788 commented Aug 30, 2023

这个功能解决了什么问题?

TextEllipsis 文本省略,http://vant-contrib.gitee.io/vant/#/zh-CN/text-ellipsis
请问vant-weapp 能实现这个组件吗,或者有别的实现方式,请教一下

你期望的 API 是什么样子的?

@lilin87788 lilin87788 changed the title [Feature Request] 请在此填写标题 extEllipsis 文本省略 Aug 30, 2023
@lilin87788
Copy link
Author

image

@johnsonwong666
Copy link
Collaborator

这个组件在vant-weapp 2.x版本计划加入,对齐vant
以下内容来自GPT,可以参考一下
使用 createSelectorQuery 创建查询上下文,以获取文本元素和容器元素的尺寸信息。
通过 boundingClientRect 方法获取文本元素和容器元素的宽度、高度等信息。
比较文本元素的高度和容器元素高度乘以行数限制,判断文本是否超出容器高度,如果超出则显示省略号和展开/收起按钮。
根据当前展开/收起状态和文本长度,截取合适的文本内容并更新 ellipsisText 数据。
在模板中根据 ellipsisText 和 showEllipsis 的值展示相应的文本和按钮。

@johnsonwong666 johnsonwong666 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
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