Skip to content

PullRefresh ​

당겨서 새로고침: 제스처 상태 머신 pulling → loosing → loading → success. 변위 계산과 상태 머신은 모두 @lh-ui/share/core/pull-refresh의 순수 로직을 소비합니다. 이 플랫폼의 스크롤载体는 컴포넌트 자체 scroll-view (refresher-enabled 시리즈 prop, 수동 제스처 없음)입니다.

플랫폼 차이(등록): uniapp/wxapp은 scroll-view refresher 이벤트를 매핑; alipay는 refresher가 없어 페이지 수준 onPullDownRefresh로 강등(페이지 수준 용법으로 등록); web은 touch 제스처.

기본 사용법 ​

vue
<template>
  <lh-pull-refresh v-model="refreshing" :head-height="50" @refresh="onRefresh">
    <view v-for="item in items" :key="item">항목 {{ item }}</view>
  </lh-pull-refresh>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const refreshing = ref(false)
const items = ref<number[]>([1, 2, 3])

function onRefresh() {
  setTimeout(() => {
    items.value = [1, 2, 3].map((i) => i + 3)
    refreshing.value = false
  }, 800)
}
</script>

커스텀 헤더 ​

head 명명된 슬롯이 기본 텍스트 힌트를 대체합니다(스코프 매개변수 { state }):

vue
<lh-pull-refresh v-model="refreshing">
  <template #head="{ state }">
    <text v-if="state === 'loading'">로딩 중…</text>
    <text v-else>아래로 당겨 새로고침</text>
  </template>
  <view>콘텐츠</view>
</lh-pull-refresh>

비활성화 ​

vue
<lh-pull-refresh :model-value="false" disabled />

Props ​

이름설명타입기본값
modelValue새로고침 중(제어, v-model)booleanfalse
headHeight헤더 높이 / 트리거 임계값 px(refresher-threshold에 매핑)number50
pullingText당기는 중 힌트(미지정 시 언어 패 pullRefresh.pulling)string—
loosingText놓기 힌트(미지정 시 언어 패 pullRefresh.loosing)string—
loadingText새로고침 중 힌트(미지정 시 언어 패 pullRefresh.loading)string—
successText성공 힌트(미지정 시 언어 패 pullRefresh.success)string—
disabled비활성화(refresher-enabled=false)booleanfalse
customClass커스텀 클래스(루트 노드로 전달)string—
sx빠른 레이아웃 propsLhSxProps—

Events ​

이벤트설명페이로드
update:modelValue새로고침 상태 변화(쓰기, v-model 경로)value: boolean
refresh최상단에서 통신: 데이터 로드 후 modelValue=false 설정—

Slots ​

이름설명
default페이지 콘텐츠
head커스텀 헤더(스코프 매개변수 { state })

접근성 ​

루트 노드의 aria-busy가 새로고침 중을 반영합니다.