/*! For license information please see 7995.98a8686e.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["7995"],{28398:function(s,n,a){"use strict";a.r(n);var t=a("80681");let e=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'

PullRefresh

\n

Intro

\n

Used to provide interactive operations for pull-down refresh.

\n

Install

\n

Register component globally via app.use, refer to Component Registration for more registration ways.

\n
import { createApp } from 'vue';\nimport { PullRefresh } from 'vant';\n\nconst app = createApp();\napp.use(PullRefresh);\n
\n

Usage

\n

Basic Usage

\n

The refresh event will be Emitted when pull refresh, you should set v-model to false to reset loading status after process refresh event.

\n
<van-pull-refresh v-model="loading" @refresh="onRefresh">\n  <p>Refresh Count: {{ count }}</p>\n</van-pull-refresh>\n
\n
import { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n  setup() {\n    const count = ref(0);\n    const loading = ref(false);\n    const onRefresh = () => {\n      setTimeout(() => {\n        showToast('Refresh Success');\n        loading.value = false;\n        count.value++;\n      }, 1000);\n    };\n\n    return {\n      count,\n      loading,\n      onRefresh,\n    };\n  },\n};\n
\n

Success Tip

\n

Use success-text to set the success prompt after the refresh is successful

\n
<van-pull-refresh\n  v-model="isLoading"\n  success-text="Refresh success"\n  @refresh="onRefresh"\n>\n  <p>Refresh Count: {{ count }}</p>\n</van-pull-refresh>\n
\n

Custom Tips

\n

Use slots to custom tips.

\n
<van-pull-refresh v-model="isLoading" :head-height="80" @refresh="onRefresh">\n  <template #pulling="props">\n    <img\n      class="doge"\n      src="https://fastly.jsdelivr.net/npm/@vant/assets/doge.png"\n      :style="{ transform: `scale(${props.distance / 80})` }"\n    />\n  </template>\n\n  <template #loosing>\n    <img\n      class="doge"\n      src="https://fastly.jsdelivr.net/npm/@vant/assets/doge.png"\n    />\n  </template>\n\n  <template #loading>\n    <img\n      class="doge"\n      src="https://fastly.jsdelivr.net/npm/@vant/assets/doge-fire.jpeg"\n    />\n  </template>\n  <p>Refresh Count: {{ count }}</p>\n</van-pull-refresh>\n\n<style>\n  .doge {\n    width: 140px;\n    height: 72px;\n    margin-top: 8px;\n    border-radius: 4px;\n  }\n</style>\n
\n

API

\n

Props

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
AttributeDescriptionTypeDefault
v-modelLoading statusboolean-
pulling-textText to show when pullingstringPull to refresh...
loosing-textText to show when loosingstringLoose to refresh...
loading-textText to show when loadingstringLoading...
success-textText to show when loading successstring-
success-durationSuccess text display duration(ms)number | string500
animation-durationAnimation durationnumber | string300
head-heightHeight of headnumber | string50
pull-distanceThe distance to trigger the pull refreshnumber | stringsame as head-height
disabledWhether to disable pull refreshbooleanfalse
\n

Events

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
EventDescriptionParameters
refreshEmitted after pulling refresh-
changeEmitted when draging or status changed{ status: string, distance: number }
\n

Slots

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameDescriptionSlotProps
defaultDefault slot-
normalContent of head when at normal status-
pullingContent of head when at pulling{ distance: number }
loosingContent of head when at loosing{ distance: number }
loadingContent of head when at loading{ distance: number }
successContent of head when succeed-
\n

Types

\n

The component exports the following type definitions:

\n
import type { PullRefreshProps } from 'vant';\n
\n

Theming

\n

CSS Variables

\n

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameDefault ValueDescription
--van-pull-refresh-head-height50px-
--van-pull-refresh-head-font-sizevar(--van-font-size-md)-
--van-pull-refresh-head-text-colorvar(--van-text-color-2)-
--van-pull-refresh-loading-icon-size16px-
\n
'},null,8,e))}}}]);