# PullRefresh

Pull-to-refresh: the gesture state machine pulling → loosing → loading → success, the displacement damping conversion (dampenPull) and the top detection (canPull) all consume the pure logic of @lh-ui/share/core/pull-refresh. The three web targets implement touch gestures by hand.

Pull to refresh (triggers on release + success hint)
<template>
  <div class="demo-col" style="gap: 18px">
    <div class="pull-demo-scroll">
      <LhPullRefresh v-model="refreshing" :head-height="50" @refresh="onRefresh">
        <div v-for="item in items" :key="item" class="pull-demo-item">Item {{ item }}</div>
      </LhPullRefresh>
    </div>
    <p class="demo-note">{{ items.length }} items · refreshed {{ times }} times</p>
  </div>
</template>

<script>
export default {
  data: () => ({
    refreshing: false,
    items: [1, 2, 3],
    times: 0,
  }),
  methods: {
    onRefresh() {
      setTimeout(() => {
        this.times += 1
        this.items = [1, 2, 3].map((i) => i + this.times * 3)
        this.refreshing = false
      }, 800)
    },
  },
}
</script>

# Custom head

The head named slot replaces the default text hints (scoped param { state }):

<LhPullRefresh v-model="refreshing">
  <template #head="{ state }">
    <span v-if="state === 'loading'">Loading…</span>
    <span v-else>{{ state === 'loosing' ? 'Release to refresh' : 'Pull to refresh' }}</span>
  </template>
  <div>Content</div>
</LhPullRefresh>

# Disabled

<LhPullRefresh :model-value="false" disabled />

# Props

Prop Description Type Default
modelValue Refreshing (controlled, v-model; the consumer sets it to false after fetching data) boolean false
headHeight Head height / trigger threshold in px number 50
pullingText Pull hint (falls back to the locale message pullRefresh.pulling when not passed) string —
loosingText Release hint (falls back to the locale message pullRefresh.loosing when not passed) string —
loadingText Refreshing hint (falls back to the locale message pullRefresh.loading when not passed) string —
successText Success hint (falls back to the locale message pullRefresh.success when not passed) string —
disabled Disable pull boolean false
sx sx shorthand layout props LhSxProps —

# Events

Event Description Payload
update:modelValue Refreshing-state change (write-back on starting / ending a refresh, the v-model path) value: boolean
refresh Released after pulling past the threshold at the top: the consumer sets modelValue=false after fetching data —

# Slots

Slot Description
default Page content
head Custom head (scoped param { state })

# Accessibility

The root element's aria-busy reflects the refreshing state.

Last Updated: 12/4/2026, 12:49:57 AM

Copyright © 2024-2026 FengMo WenXue