Skip to content

Commit 6e31940

Browse files
committed
feat(TextEllipsis): define text style and class, support more prop
1 parent 1007f7b commit 6e31940

6 files changed

Lines changed: 62 additions & 25 deletions

File tree

doc/components/component/textellipsis.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@
7070
<td>-</td>
7171
<td></td>
7272
</tr>
73+
<tr>
74+
<td>more</td>
75+
<td>Text displayed when defining abbreviations, 1.25.0+</td>
76+
<td>String</td>
77+
<td>-</td>
78+
<td></td>
79+
</tr>
80+
<tr>
81+
<td>textStyle</td>
82+
<td>文字的style, 1.25.0+</td>
83+
<td>String, Object, Array</td>
84+
<td>-</td>
85+
<td></td>
86+
</tr>
87+
<tr>
88+
<td>textClass</td>
89+
<td>文字的class, 1.25.0+</td>
90+
<td>String, Object, Array</td>
91+
<td>-</td>
92+
<td></td>
93+
</tr>
7394
</table>
7495

7596
<h3>TextEllipsis 事件</h3>

doc/components/demos/other/textellipsis5.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<div>
3-
<TextEllipsis v-for="text of texts" :key="text" :text="text" :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
4-
<template slot="more">...</template>
3+
<TextEllipsis v-for="text of texts" textClass="link" @click="go" :key="text" :text="text" more="..." :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
54
</TextEllipsis>
65
</div>
76
</template>
@@ -18,7 +17,9 @@ export default {
1817
};
1918
},
2019
methods: {
21-
20+
go() {
21+
this.$Message('跳转');
22+
}
2223
}
2324
};
2425
</script>

doc/components_en/component/textellipsis.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@
7070
<td>-</td>
7171
<td></td>
7272
</tr>
73+
<tr>
74+
<td>more</td>
75+
<td>定义缩略时展示的文字, 1.25.0+</td>
76+
<td>String</td>
77+
<td>-</td>
78+
<td></td>
79+
</tr>
80+
<tr>
81+
<td>textStyle</td>
82+
<td>text style, 1.25.0+</td>
83+
<td>String, Object, Array</td>
84+
<td>-</td>
85+
<td></td>
86+
</tr>
87+
<tr>
88+
<td>textClass</td>
89+
<td>text class, 1.25.0+</td>
90+
<td>String, Object, Array</td>
91+
<td>-</td>
92+
<td></td>
93+
</tr>
7394
</table>
7495

7596
<h3>TextEllipsis Event</h3>

doc/components_en/demos/other/textellipsis5.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<TextEllipsis v-for="text of texts" :key="text" :text="text" :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
3+
<TextEllipsis v-for="text of texts" :key="text" textClass="link" @click="go" :text="text" :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
44
<template slot="more">...</template>
55
</TextEllipsis>
66
</div>
@@ -16,6 +16,10 @@ export default {
1616
]
1717
};
1818
},
19-
methods: {}
19+
methods: {
20+
go() {
21+
this.$Message('Jump');
22+
}
23+
}
2024
};
2125
</script>

src/components/text-ellipsis/textellipsis.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<template>
22
<div class="h-text-ellipsis">
33
<slot name="before" class="h-text-ellipsis-before"></slot>
4-
<span class="h-text-ellipsis-limit-text" :key="keyIndex" v-tooltip="useTooltip&&isHide" :theme="tooltipTheme" :placement="placement" :content="text">{{text}}</span>
5-
<span class="h-text-ellipsis-more" v-show='oversize'><slot name="more"></slot></span>
4+
<span :style="textStyle" :class="textClass" @click="textClick" v-tooltip="useTooltip&&isHide" :theme="tooltipTheme" :placement="placement" :content="text">
5+
<span class="h-text-ellipsis-limit-text" :key="keyIndex">{{text}}</span><span class="h-text-ellipsis-more" v-show='oversize'>{{more}}<slot name="more"></slot></span>
6+
</span>
67
<slot name="after" class="h-text-ellipsis-after"></slot>
78
</div>
89
</template>
@@ -22,7 +23,10 @@ export default {
2223
default: false
2324
},
2425
tooltipTheme: String,
25-
placement: String
26+
placement: String,
27+
textStyle: [String, Object, Array],
28+
textClass: [String, Object, Array],
29+
more: String
2630
},
2731
data() {
2832
return {
@@ -55,6 +59,9 @@ export default {
5559
this.limitShow();
5660
}
5761
},
62+
textClick() {
63+
this.$emit('click');
64+
},
5865
limitShow() {
5966
this.$nextTick(() => {
6067
let textDom = this.$el.querySelector('.h-text-ellipsis-limit-text');

src/components/tree/tree.vue

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,6 @@ const getChooseNode = (data, options) => {
7878
return options;
7979
};
8080
81-
const updateModeSomeChildChooseStatus = data => {
82-
if (data.children) {
83-
let isChoose = false;
84-
for (let child of data.children) {
85-
// updateChildStatus(child);
86-
if (child.status.choose) {
87-
isChoose = true;
88-
}
89-
updateModeSomeChildChooseStatus(child);
90-
}
91-
if (isChoose) {
92-
data.status.choose = true;
93-
data.status.opened = true;
94-
}
95-
}
96-
};
97-
9881
export default {
9982
name: 'hTree',
10083
props: {

0 commit comments

Comments
 (0)