Skip to content

FloatingPanel 플로팅 패널 ​

플로팅 패널 컴포넌트: fixed 하단 패널, 헤더 드래그로 손을 따라가고 놓으면 가장 가까운 앵커에 스냅됩니다. 앵커 기하학(퍼센트 환산 / 최단 앵커 / 스냅 판정 / 드래그 클램핑)은 모두 @lh-ui/share/core/floating-panel 순수 함수를 소비합니다. 뷰포트 높이는 @/adapter/platform을 통해 가져오며(H5 innerHeight / 미니프로그램 windowHeight), 컴포넌트 계층은 uni API를 직접 호출하지 않습니다. 필터링, 상세 호스팅, 하단 작업 등에 활용됩니다.

플랫폼 차이(등록): 뷰포트 높이는 플랫폼 어댑터로 가져옵니다(getLhWindowInfo: H5는 window.innerHeight, 미니프로그램은 uni.getWindowInfo().windowHeight); 드래그는 touch 이벤트로 통일되고(H5와 MP 동일, 좌표는 touches[0].clientY); 패널의 fixed 위치는 루트 노드에 있고(share styles/floating-panel의 정제 산물) 높이는 인라인 style이 담당하며, 드래그 중에는 --dragging 수식어로 전환을 꺼 손을 따라가게 합니다.

기본 사용법 ​

기본 앵커는 [60, '40%'](60px와 뷰포트 높이의 40% 두 단)입니다:

vue
<template>
  <lh-floating-panel>
    <view>패널 내용</view>
  </lh-floating-panel>
</template>

커스텀 앵커 ​

anchors는 높이 배열입니다: 숫자는 px, '40%' 같은 문자열은 뷰포트 높이 대비 퍼센트입니다; 드래그를 놓으면 가장 가까운 앵커에 스냅됩니다:

vue
<lh-floating-panel :anchors="[120, 320, 560]" @change="onChange" />

제어되는 단계(v-model) ​

modelValue를 전달하면 제어형이 됩니다: 외부에서 단계를 밀면 패널 높이가 동기화되고, 드래그를 놓으면 update:modelValue / change가 발생합니다:

vue
<lh-floating-panel v-model="index" :anchors="[80, 400]" />

헤더만 드래그 가능 ​

contentDraggable(기본 true)을 false로 하면 헤더 손잡이 영역만 드래그에 반응하고, 콘텐츠 영역(예: 스크롤 목록)은 드래그를 가져가지 않습니다:

vue
<lh-floating-panel :content-draggable="false" :anchors="[100, 300]">
  <scroll-view scroll-y>긴 스크롤 내용</scroll-view>
</lh-floating-panel>

비활성화와 안전 영역 ​

vue
<lh-floating-panel disabled :anchors="[100, 300]" />
<lh-floating-panel :safe-area-inset-bottom="false" :anchors="[100, 300]" />

커스텀 헤더 ​

header 슬롯이 기본 손잡이를 대체합니다(슬롯 콘텐츠도 드래그 영역 그대로):

vue
<lh-floating-panel :anchors="[100, 300]">
  <template #header>
    <view>커스텀 헤더</view>
  </template>
</lh-floating-panel>

Props ​

Prop설명타입기본값
anchors스냅 높이 배열(px 숫자 또는 '퍼센트' 문자열)`(numberstring)[]`
modelValue현재 스냅 단계 인덱스(제어형)number—
contentDraggable콘텐츠 영역 드래그 가능booleantrue
safeAreaInsetBottom하단 안전 영역 여백booleantrue
disabled드래그 비활성화booleanfalse
customClass커스텀 클래스(루트 노드로 전달)string—
sxsx 빠른 레이아웃 속성LhSxProps—

이벤트 ​

이벤트설명콜백 인수
update:modelValue단계 변화(제어형 동기화)(index: number)
change놓아서 스냅된 후 단계 변화(index: number)
heightChange패널 높이 변화(드래그 추적 + 스냅)(height: number)

슬롯 ​

슬롯설명
header헤더 드래그 영역(기본으로 __handle 손잡이 렌더링)
default패널 콘텐츠

접근성 ​

루트 노드는 role="region" 의미를 가지며, aria-label은 share core의 getFloatingPanelAria가 생성합니다(기본 「플로팅 패널 i / N 단계」). 비활성 시 aria-disabled가 설정됩니다.