1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| <template>
| <div :class="{'line': row === 1, 'lines': row > 1}"
| :title="hoverTip ? content: null"
| :style="{'--row':row}">
| <slot name="pre"></slot>
| {{content}}
| </div>
| </template>
|
| <script>
| //超出指定行数自动隐藏文字
| export default {
| name: "Ellipsis",
| install(Vue){
| Vue.component('ellipsis', this)
| },
| components: {},
| props:{
| row: {
| type: Number,
| default: 1
| },
| hoverTip:{
| type: Boolean,
| default: false
| },
| content:{
| type: String,
| default: ''
| }
| },
| data() {
| return {}
| },
| methods: {}
| }
| </script>
|
| <style lang="less" scoped>
|
| .line{
| white-space: nowrap;
| overflow: hidden;
| text-overflow: ellipsis;
| }
| .lines{
| display: -webkit-box;
| word-break: break-all;
| overflow: hidden;
| text-overflow: ellipsis;
| -webkit-line-clamp: var(--row);
| -webkit-box-orient: vertical;
| }
| </style>
|
|