diff --git a/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts b/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts
index b297c3c9..9e2d13b8 100644
--- a/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts
+++ b/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts
@@ -31,9 +31,16 @@ describe('ellipsis-text.vue', () => {
default: 'This is a very long text that should be truncated.',
},
});
-
const ellipsis = wrapper.find('.truncate');
+
+ // 点击 ellipsis,应该触发 expandChange,参数为 false
await ellipsis.trigger('click');
expect(wrapper.emitted('expandChange')).toBeTruthy();
+ expect(wrapper.emitted('expandChange')?.[0]).toEqual([true]);
+
+ // 再次点击,应该触发 expandChange,参数为 false
+ await ellipsis.trigger('click');
+ expect(wrapper.emitted('expandChange')?.length).toBe(2);
+ expect(wrapper.emitted('expandChange')?.[1]).toEqual([false]);
});
});
diff --git a/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue b/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue
index f57cccc9..4455a00a 100644
--- a/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue
+++ b/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue
@@ -1,5 +1,5 @@
@@ -118,7 +103,7 @@ function handleExpand() {
color: tooltipColor,
backgroundColor: tooltipBackgroundColor,
}"
- :disabled="!showTooltip"
+ :disabled="!props.tooltip || isExpand"
:side="placement"
>
@@ -133,7 +118,10 @@ function handleExpand() {
['inline-block truncate']: line === 1,
[$style.ellipsisMultiLine]: line > 1,
}"
- :style="`-webkit-line-clamp: ${line}; max-width: ${textMaxWidth};`"
+ :style="{
+ '-webkit-line-clamp': isExpand ? '' : line,
+ 'max-width': textMaxWidth,
+ }"
class="cursor-text overflow-hidden"
@click="handleExpand"
v-bind="$attrs"