Skip to content

Commit

Permalink
feat(TextEllipsis): define text style and class, support more prop
Browse files Browse the repository at this point in the history
  • Loading branch information
vvpvvp committed Aug 29, 2019
1 parent 1007f7b commit 6e31940
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 25 deletions.
21 changes: 21 additions & 0 deletions doc/components/component/textellipsis.vue
Expand Up @@ -70,6 +70,27 @@
<td>-</td>
<td></td>
</tr>
<tr>
<td>more</td>
<td>Text displayed when defining abbreviations, 1.25.0+</td>
<td>String</td>
<td>-</td>
<td></td>
</tr>
<tr>
<td>textStyle</td>
<td>文字的style, 1.25.0+</td>
<td>String, Object, Array</td>
<td>-</td>
<td></td>
</tr>
<tr>
<td>textClass</td>
<td>文字的class, 1.25.0+</td>
<td>String, Object, Array</td>
<td>-</td>
<td></td>
</tr>
</table>

<h3>TextEllipsis 事件</h3>
Expand Down
7 changes: 4 additions & 3 deletions doc/components/demos/other/textellipsis5.vue
@@ -1,7 +1,6 @@
<template>
<div>
<TextEllipsis v-for="text of texts" :key="text" :text="text" :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
<template slot="more">...</template>
<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">
</TextEllipsis>
</div>
</template>
Expand All @@ -18,7 +17,9 @@ export default {
};
},
methods: {
go() {
this.$Message('跳转');
}
}
};
</script>
21 changes: 21 additions & 0 deletions doc/components_en/component/textellipsis.vue
Expand Up @@ -70,6 +70,27 @@
<td>-</td>
<td></td>
</tr>
<tr>
<td>more</td>
<td>定义缩略时展示的文字, 1.25.0+</td>
<td>String</td>
<td>-</td>
<td></td>
</tr>
<tr>
<td>textStyle</td>
<td>text style, 1.25.0+</td>
<td>String, Object, Array</td>
<td>-</td>
<td></td>
</tr>
<tr>
<td>textClass</td>
<td>text class, 1.25.0+</td>
<td>String, Object, Array</td>
<td>-</td>
<td></td>
</tr>
</table>

<h3>TextEllipsis Event</h3>
Expand Down
8 changes: 6 additions & 2 deletions doc/components_en/demos/other/textellipsis5.vue
@@ -1,6 +1,6 @@
<template>
<div>
<TextEllipsis v-for="text of texts" :key="text" :text="text" :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
<TextEllipsis v-for="text of texts" :key="text" textClass="link" @click="go" :text="text" :height="40" v-width="300" useTooltip tooltipTheme="white" placement="right">
<template slot="more">...</template>
</TextEllipsis>
</div>
Expand All @@ -16,6 +16,10 @@ export default {
]
};
},
methods: {}
methods: {
go() {
this.$Message('Jump');
}
}
};
</script>
13 changes: 10 additions & 3 deletions src/components/text-ellipsis/textellipsis.vue
@@ -1,8 +1,9 @@
<template>
<div class="h-text-ellipsis">
<slot name="before" class="h-text-ellipsis-before"></slot>
<span class="h-text-ellipsis-limit-text" :key="keyIndex" v-tooltip="useTooltip&&isHide" :theme="tooltipTheme" :placement="placement" :content="text">{{text}}</span>
<span class="h-text-ellipsis-more" v-show='oversize'><slot name="more"></slot></span>
<span :style="textStyle" :class="textClass" @click="textClick" v-tooltip="useTooltip&&isHide" :theme="tooltipTheme" :placement="placement" :content="text">
<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>
</span>
<slot name="after" class="h-text-ellipsis-after"></slot>
</div>
</template>
Expand All @@ -22,7 +23,10 @@ export default {
default: false
},
tooltipTheme: String,
placement: String
placement: String,
textStyle: [String, Object, Array],
textClass: [String, Object, Array],
more: String
},
data() {
return {
Expand Down Expand Up @@ -55,6 +59,9 @@ export default {
this.limitShow();
}
},
textClick() {
this.$emit('click');
},
limitShow() {
this.$nextTick(() => {
let textDom = this.$el.querySelector('.h-text-ellipsis-limit-text');
Expand Down
17 changes: 0 additions & 17 deletions src/components/tree/tree.vue
Expand Up @@ -78,23 +78,6 @@ const getChooseNode = (data, options) => {
return options;
};
const updateModeSomeChildChooseStatus = data => {
if (data.children) {
let isChoose = false;
for (let child of data.children) {
// updateChildStatus(child);
if (child.status.choose) {
isChoose = true;
}
updateModeSomeChildChooseStatus(child);
}
if (isChoose) {
data.status.choose = true;
data.status.opened = true;
}
}
};
export default {
name: 'hTree',
props: {
Expand Down

0 comments on commit 6e31940

Please sign in to comment.