/*! For license information please see 5962.27f0976e.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["5962"],{56985:function(s,n,a){"use strict";a.r(n);var t=a("80681");let l=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
\u7528\u4E8E\u63D0\u4F9B\u4E0B\u62C9\u5237\u65B0\u7684\u4EA4\u4E92\u64CD\u4F5C\u3002
\n\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003\u7EC4\u4EF6\u6CE8\u518C\u3002
\nimport { createApp } from 'vue';\nimport { PullRefresh } from 'vant';\n\nconst app = createApp();\napp.use(PullRefresh);\n
\n\u4E0B\u62C9\u5237\u65B0\u65F6\u4F1A\u89E6\u53D1 refresh
\u4E8B\u4EF6\uFF0C\u5728\u4E8B\u4EF6\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u53EF\u4EE5\u8FDB\u884C\u540C\u6B65\u6216\u5F02\u6B65\u64CD\u4F5C\uFF0C\u64CD\u4F5C\u5B8C\u6210\u540E\u5C06 v-model
\u8BBE\u7F6E\u4E3A false
\uFF0C\u8868\u793A\u52A0\u8F7D\u5B8C\u6210\u3002
<van-pull-refresh v-model="loading" @refresh="onRefresh">\n <p>\u5237\u65B0\u6B21\u6570: {{ count }}</p>\n</van-pull-refresh>\n
\nimport { 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('\u5237\u65B0\u6210\u529F');\n loading.value = false;\n count.value++;\n }, 1000);\n };\n\n return {\n count,\n loading,\n onRefresh,\n };\n },\n};\n
\n\u901A\u8FC7 success-text
\u53EF\u4EE5\u8BBE\u7F6E\u5237\u65B0\u6210\u529F\u540E\u7684\u9876\u90E8\u63D0\u793A\u6587\u6848\u3002
<van-pull-refresh\n v-model="isLoading"\n success-text="\u5237\u65B0\u6210\u529F"\n @refresh="onRefresh"\n>\n <p>\u5237\u65B0\u6B21\u6570: {{ count }}</p>\n</van-pull-refresh>\n
\n\u901A\u8FC7\u63D2\u69FD\u53EF\u4EE5\u81EA\u5B9A\u4E49\u4E0B\u62C9\u5237\u65B0\u8FC7\u7A0B\u4E2D\u7684\u63D0\u793A\u5185\u5BB9\u3002
\n<van-pull-refresh v-model="isLoading" :head-height="80" @refresh="onRefresh">\n <!-- \u4E0B\u62C9\u63D0\u793A\uFF0C\u901A\u8FC7 scale \u5B9E\u73B0\u4E00\u4E2A\u7F29\u653E\u6548\u679C -->\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 <!-- \u91CA\u653E\u63D0\u793A -->\n <template #loosing>\n <img\n class="doge"\n src="https://fastly.jsdelivr.net/npm/@vant/assets/doge.png"\n />\n </template>\n\n <!-- \u52A0\u8F7D\u63D0\u793A -->\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>\u5237\u65B0\u6B21\u6570: {{ 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\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model | \n\u662F\u5426\u5904\u4E8E\u52A0\u8F7D\u4E2D\u72B6\u6001 | \nboolean | \n- | \n
pulling-text | \n\u4E0B\u62C9\u8FC7\u7A0B\u63D0\u793A\u6587\u6848 | \nstring | \n\u4E0B\u62C9\u5373\u53EF\u5237\u65B0... | \n
loosing-text | \n\u91CA\u653E\u8FC7\u7A0B\u63D0\u793A\u6587\u6848 | \nstring | \n\u91CA\u653E\u5373\u53EF\u5237\u65B0... | \n
loading-text | \n\u52A0\u8F7D\u8FC7\u7A0B\u63D0\u793A\u6587\u6848 | \nstring | \n\u52A0\u8F7D\u4E2D... | \n
success-text | \n\u5237\u65B0\u6210\u529F\u63D0\u793A\u6587\u6848 | \nstring | \n- | \n
success-duration | \n\u5237\u65B0\u6210\u529F\u63D0\u793A\u5C55\u793A\u65F6\u957F(ms) | \nnumber | string | \n500 | \n
animation-duration | \n\u52A8\u753B\u65F6\u957F | \nnumber | string | \n300 | \n
head-height | \n\u9876\u90E8\u5185\u5BB9\u9AD8\u5EA6 | \nnumber | string | \n50 | \n
pull-distance | \n\u89E6\u53D1\u4E0B\u62C9\u5237\u65B0\u7684\u8DDD\u79BB | \nnumber | string | \n\u4E0E head-height \u4E00\u81F4 | \n
disabled | \n\u662F\u5426\u7981\u7528\u4E0B\u62C9\u5237\u65B0 | \nboolean | \nfalse | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
refresh | \n\u4E0B\u62C9\u5237\u65B0\u65F6\u89E6\u53D1 | \n- | \n
change | \n\u62D6\u52A8\u65F6\u6216\u72B6\u6001\u6539\u53D8\u65F6\u89E6\u53D1 | \n{ status: string, distance: number } | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
default | \n\u81EA\u5B9A\u4E49\u5185\u5BB9 | \n- | \n
normal | \n\u975E\u4E0B\u62C9\u72B6\u6001\u65F6\u9876\u90E8\u5185\u5BB9 | \n- | \n
pulling | \n\u4E0B\u62C9\u8FC7\u7A0B\u4E2D\u9876\u90E8\u5185\u5BB9 | \n{ distance: number } | \n
loosing | \n\u91CA\u653E\u8FC7\u7A0B\u4E2D\u9876\u90E8\u5185\u5BB9 | \n{ distance: number } | \n
loading | \n\u52A0\u8F7D\u8FC7\u7A0B\u4E2D\u9876\u90E8\u5185\u5BB9 | \n{ distance: number } | \n
success | \n\u5237\u65B0\u6210\u529F\u63D0\u793A\u5185\u5BB9 | \n- | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type { PullRefreshProps } from 'vant';\n
\n\u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E0B\u5217 CSS \u53D8\u91CF\uFF0C\u53EF\u7528\u4E8E\u81EA\u5B9A\u4E49\u6837\u5F0F\uFF0C\u4F7F\u7528\u65B9\u6CD5\u8BF7\u53C2\u8003 ConfigProvider \u7EC4\u4EF6\u3002
\n\u540D\u79F0 | \n\u9ED8\u8BA4\u503C | \n\u63CF\u8FF0 | \n
---|---|---|
--van-pull-refresh-head-height | \n50px | \n- | \n
--van-pull-refresh-head-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-pull-refresh-head-text-color | \nvar(--van-text-color-2) | \n- | \n
--van-pull-refresh-loading-icon-size | \n16px | \n- | \n
\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4E0B\u62C9\u533A\u57DF\u7684\u9AD8\u5EA6\u662F\u548C\u5185\u5BB9\u9AD8\u5EA6\u4FDD\u6301\u4E00\u81F4\u7684\uFF0C\u5982\u679C\u9700\u8981\u8BA9\u4E0B\u62C9\u533A\u57DF\u59CB\u7EC8\u4E3A\u5168\u5C4F\uFF0C\u53EF\u4EE5\u7ED9 PullRefresh \u8BBE\u7F6E\u4E00\u4E2A\u4E0E\u5C4F\u5E55\u5927\u5C0F\u76F8\u7B49\u7684\u6700\u5C0F\u9AD8\u5EA6\uFF1A
\n<van-pull-refresh style="min-height: 100vh;" />\n
\nPullRefresh \u7684\u89E6\u53D1\u6761\u4EF6\u662F\u300C\u7236\u7EA7\u6EDA\u52A8\u5143\u7D20\u7684\u6EDA\u52A8\u6761\u5728\u9876\u90E8\u4F4D\u7F6E\u300D\u3002
\nwindow
\uFF0C\u5219\u8981\u6C42 window.pageYOffset === 0
\u3002Element
\uFF0C\u5219\u8981\u6C42 Element.scrollTop === 0
\u3002\u53C2\u89C1\u684C\u9762\u7AEF\u9002\u914D\u3002
\n