Repository navigation
feat(ellipsis): support expand only when the text is overflowed - #2022
Merged
haoziqaq merged 2 commits intoOct 12, 2026
Merged
Conversation
The component measures the content and the container, and only enables the pointer cursor and the expand interaction when the text is overflowed. Measure on mount, container resize and line-clamp change.
|
@william-xue is attempting to deploy a commit to the varletjs Team on Vercel. A member of the Team first needs to authorize it. |
@varlet/cli
@varlet/icons
@varlet/import-resolver
@varlet/preset-tailwindcss
@varlet/preset-unocss
@varlet/shared
@varlet/touch-emulator
@varlet/ui
@varlet/use
@varlet/vite-plugins
commit: |
haoziqaq
reviewed
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Change information
var-ellipsis新增expand-on-overflow属性:开启后组件自己判断内容有没有被省略,只有被省略时才显示手型光标、才响应点击展开。scrollWidth/clientWidth,line-clamp场景比较scrollHeight/clientHeight@varlet/use的useResizeObserver监听,挂载与line-clamp变化时也会重新测量tooltip的显示时机也没动,避免影响已经在用的项目Validation:
pnpm exec varlet-cli test -c ellipsis13 个用例通过(新增 6 个:未省略不展开、已省略可展开、line-clamp下按高度判断、未省略且line-clamp时不展开、默认关闭时行为不变)pnpm lint通过Issues
close #2012
Related Links
None.