Skip to content

文本省略 Ellipsis ...能支持自定义吗?我想显示...查看更多 #4000

Closed Answered by h7ml
reallifebogz asked this question in Q&A
Discussion options

You must be logged in to vote

ellipsis 组件

const ellipsisStyleRef = computed(() => {
const { lineClamp } = props
const { value: expanded } = expandedRef
if (lineClamp !== undefined) {
return {
textOverflow: '',
'-webkit-line-clamp': expanded ? '' : lineClamp
}
} else {
return {
textOverflow: expanded ? '' : 'ellipsis',
'-webkit-line-clamp': ''
}
}
})
是基于css属性-webkit-line-clamp来实现的,查了下属性表。并没有相关的将...替换为文本/标签相关文档。

但是 可以使用https://www.npmjs.com/package/ember-line-clamp 该库来实现自定义查看更多功能

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jahnli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants