feat(Style): add multi-line ellipsis classes (#4690)
This commit is contained in:
+9
-1
@@ -10,7 +10,15 @@ When the text content length exceeds the maximum container width, the excess tex
|
||||
|
||||
```html
|
||||
<div class="van-ellipsis">
|
||||
This is a paragraph of 250px width limit, the back will be omitted.
|
||||
This is a paragraph that displays up to one line of text, and the rest of the text will be omitted.
|
||||
</div>
|
||||
|
||||
<div class="van-multi-ellipsis--l2">
|
||||
This is a paragraph that displays up to two lines of text, and the rest of the text will be omitted.
|
||||
</div>
|
||||
|
||||
<div class="van-multi-ellipsis--l3">
|
||||
This is a paragraph that displays up to three lines of text, and the rest of the text will be omitted.
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
@@ -9,7 +9,14 @@ Vant 中默认包含了一些常用样式,可以直接通过 className 的方
|
||||
当文本内容长度超过容器最大宽度时,自动省略多余的文本。
|
||||
|
||||
```html
|
||||
<div class="van-ellipsis">这是一段宽度限制 250px 的文字,后面的内容会省略</div>
|
||||
<!-- 最多显示一行 -->
|
||||
<div class="van-ellipsis">这是一段最多显示一行的文字,多余的内容会被省略</div>
|
||||
|
||||
<!-- 最多显示两行 -->
|
||||
<div class="van-multi-ellipsis--l2">这是一段最多显示两行的文字,多余的内容会被省略</div>
|
||||
|
||||
<!-- 最多显示三行 -->
|
||||
<div class="van-multi-ellipsis--l3">这是一段最多显示三行的文字,多余的内容会被省略</div>
|
||||
```
|
||||
|
||||
### 1px 边框
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<demo-section>
|
||||
<demo-block :title="$t('ellipsis')">
|
||||
<div class="van-ellipsis">{{ $t('text') }}</div>
|
||||
<div class="van-ellipsis">{{ $t('text1') }}</div>
|
||||
<div class="van-multi-ellipsis--l2">{{ $t('text2') }}</div>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('hairline')">
|
||||
@@ -53,14 +54,16 @@ export default {
|
||||
ellipsis: '文字省略',
|
||||
animation: '动画',
|
||||
toggle: '切换动画',
|
||||
text: '这是一段宽度限制 250px 的文字,后面的内容会省略'
|
||||
text1: '这是一段最多显示一行的文字,后面的内容会省略',
|
||||
text2: '这是一段最多显示两行的文字,后面的内容会省略。这是一段最多显示两行的文字,后面的内容会省略'
|
||||
},
|
||||
'en-US': {
|
||||
hairline: 'Hairline',
|
||||
ellipsis: 'Text Ellipsis',
|
||||
animation: 'Animation',
|
||||
toggle: 'Switch animation',
|
||||
text: 'This is a paragraph of 250px width limit, the back will be omitted.'
|
||||
text1: 'This is a paragraph that displays up to one line of text, and the rest of the text will be omitted.',
|
||||
text2: 'This is a paragraph that displays up to two lines of text, and the rest of the text will be omitted.'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -88,10 +91,16 @@ export default {
|
||||
@import '../../style/var';
|
||||
|
||||
.demo-style {
|
||||
.van-ellipsis {
|
||||
max-width: 250px;
|
||||
.van-ellipsis,
|
||||
.van-multi-ellipsis--l2 {
|
||||
max-width: 300px;
|
||||
margin-left: @padding-md;
|
||||
font-size: 13px;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.van-ellipsis {
|
||||
margin-bottom: @padding-md;
|
||||
}
|
||||
|
||||
.van-hairline--top {
|
||||
|
||||
@@ -3,3 +3,11 @@
|
||||
.van-ellipsis {
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
.van-multi-ellipsis--l2 {
|
||||
.multi-ellipsis(2);
|
||||
}
|
||||
|
||||
.van-multi-ellipsis--l3 {
|
||||
.multi-ellipsis(3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user