🌀(component): tag-input 样式, tag-width 超出 input 宽度时自动省略文本

This commit is contained in:
就眠儀式
2022-11-15 23:57:11 +08:00
parent 11eada1d9d
commit c1325055fb
3 changed files with 19 additions and 5 deletions

View File

@@ -55,7 +55,7 @@ const classTag = computed(() => [
const styleTag = computed(() => [
{
"max-width": props.maxWidth ?? "unset",
"max-width": props.maxWidth ?? "100%",
...useTagCustomStyle(props).value,
},
]);
@@ -105,10 +105,12 @@ function useTagCustomStyle(props: TagProps) {
<span v-if="$slots.icon" class="layui-tag-icon">
<slot name="icon" />
</span>
<span v-if="maxWidth" :style="styleTag" class="layui-tag-text">
<slot />
<span style="overflow: hidden;text-overflow: ellipsis;white-space:nowrap;">
<span v-if="maxWidth" :style="styleTag" class="layui-tag-text">
<slot />
</span>
<slot v-else />
</span>
<slot v-else />
<span
v-if="closable"
class="layui-tag-close-icon"

View File

@@ -86,7 +86,7 @@
display: flex;
align-items: center;
flex-wrap: wrap;
width: fit-content;
width: 100%;
height: auto;
overflow: hidden;