fix: 修复table列表tooltip展示不全

This commit is contained in:
xinxin.wu 2024-09-23 14:36:45 +08:00 committed by Craftsman
parent 18997cdda7
commit f6efb24040
2 changed files with 11 additions and 5 deletions

View File

@ -7,12 +7,15 @@
<MsTag
v-for="tag of showTagList"
:key="tag.id"
class="ms-tag-group"
:class="`${props.showTable ? 'ms-tag-group' : ''}`"
:width="getTagWidth(tag)"
:size="props.size"
v-bind="attrs"
>
{{ getTagContent(tag) }}
<template v-if="props.showTable" #tooltipContent>
{{ props.isStringTag ? tag : tag[props.nameKey] }}
</template>
</MsTag>
<a-tooltip
:disabled="!(props.tagList.length > props.showNum)"
@ -114,9 +117,9 @@
});
function getTagContent(tag: { [x: string]: any }) {
let tagContent = props.isStringTag ? tag : tag[props.nameKey];
if (tagContent.length > 16) {
tagContent = characterLimit(tagContent, 9);
const tagContent = props.isStringTag ? tag : tag[props.nameKey];
if (props.showTable) {
return tagContent.length > 16 ? characterLimit(tagContent, 9) : tagContent;
}
return tagContent;
}

View File

@ -18,7 +18,10 @@
<div :class="`one-line-text min-w-[20px] ${props.maxWidth || '144px'}`">
<slot></slot>
</div>
<template #content>
<template v-if="$slots.tooltipContent" #content>
<slot name="tooltipContent"></slot>
</template>
<template v-else #content>
<slot></slot>
</template>
</a-tooltip>