组件
文本省略 Ellipsis
Ellipsis:文本截断。文本可截断为一行,或限制为 N 行。基础组件只负责截断;是否通过 title 或 tooltip 提供完整文本,由使用者决定。
#基础用法
A long chapter title walks into a narrow column and leaves its tail at the door
<script setup lang="ts">
import { Ellipsis } from "@bysages/vue";
const title = "A long chapter title walks into a narrow column and leaves its tail at the door";
</script>
<template>
<div class="w-80">
<Ellipsis :title="title">{{ title }}</Ellipsis>
</div>
</template>
The vessel holds the page the way a column holds ink: fully, and only up to its brim. Whatever runs past the measure gives way, and the cut is drawn so quietly that the reader finishes the sentence from memory instead of the margin.The vessel holds the page the way a column holds ink: fully, and only up to its brim. Whatever runs past the measure gives way, and the cut is drawn so quietly that the reader finishes the sentence from memory instead of the margin.
<script setup lang="ts">
import { Ellipsis } from "@bysages/vue";
const prose =
"The vessel holds the page the way a column holds ink: fully, and only up to its brim. " +
"Whatever runs past the measure gives way, and the cut is drawn so quietly that the reader " +
"finishes the sentence from memory instead of the margin.";
</script>
<template>
<div class="grid grid-cols-2 gap-4 w-full">
<Ellipsis :lines="2">{{ prose }}</Ellipsis>
<Ellipsis :lines="4">{{ prose }}</Ellipsis>
</div>
</template>
#属性
#Ellipsis
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
lines | Number | 1 | — |