Skip to content

Ellipsis ​

텍스트 생략: 여러 줄은 CSS line-clamp 우선(행수는 --lh-ellipsis-rows CSS 변수로 지정), position="middle"은 JS 잘라내기(truncateMiddle, 모든 포트 공통). 확장/접기, 중간 생략, 커스텀 action 시나리오를 지원합니다.

플랫폼 차이(등록): 이 포트에는 특화 없음 — end는 모든 포트 CSS 엔진이 지원하는 -webkit-line-clamp, middle은 share core의 truncateMiddle JS 잘라내기; 잘라내기와 상태 계산은 모두 share core 순수 함수를 재사용합니다.

기본 사용법 ​

vue
<template>
  <lh-ellipsis :content="longText" />
  <lh-ellipsis :content="longText" :rows="2" />
  <lh-ellipsis :content="longText" position="middle" />
</template>

<script setup lang="ts">
  const longText = 'lh-ui 是一个跨端组件库家族,双血脉架构,八仓齐发,文档站十站齐备'
</script>

제어형 확장 ​

expanded를 전달하면 제어 상태로(v-model:expanded); change는 action 클릭마다 발화:

vue
<lh-ellipsis :content="longText" :rows="2" expandable v-model:expanded="open" />

Props ​

속성설명타입기본값
content텍스트 내용string—
rows접혔을 때 표시 행수(>= 1; 잘못된 값은 1로 정규화)number1
expandable확장 / 접기 action 렌더링booleanfalse
expanded확장 상태(제어; 미지정 시 내부 관리)boolean—
actionTextaction 라벨(미지정 시 i18n ellipsis.expand / collapse)string—
position잘라내기 위치: end는 CSS line-clamp; middle은 단일 줄 JS 잘라내기'end' | 'middle''end'
ellipsisLabel접근성 라벨(미지정 시 내용 첫 40자)string—
customClass커스텀 클래스(루트로 전달)string—
sxsx 퀵 레이아웃 속성LhSxProps—

Events ​

이벤트설명콜백
update:expanded확장 상태 쓰기 저장(v-model:expanded)expanded: boolean
change확장 상태 변화expanded: boolean
clickActionaction 클릭(change와 동시 발화)—

접근성 ​

  • action은 독립 포커스 가능 노드(role="button"), aria-expanded는 확장 상태와 동기화; 루트 aria-label의 기본값은 내용 첫 40자입니다.