Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository has been archived by the owner. It is now read-only.
/vue-pull-toPublic archive

⚡️ A pull-down refresh and pull-up load more and infinite scroll component for Vue.js --Vue下拉刷新组件

License

NotificationsYou must be signed in to change notification settings

stackjie/vue-pull-to

Repository files navigation

A pull-down refresh and pull-up load more and infinite scroll component for Vue.js.

zh-CN中文文档

Build StatusCoverage StatusGitHub issuesGitHub starsGitHub licensenpm

Live Examples

qrcode

examples

Installation

 npm install vue-pull-to --save

Usage

<template>  <div>    <pull-to:top-load-method="refresh">      <ulv-for="item in dataList">        <li>{{ item }}</li>      </ul>    </pull-to>  </div> </template><script>importPullTofrom'vue-pull-to'import {fetchDataList }from'api'exportdefault {    name:'example',    components: {      PullTo    },data() {return {        dataList: []      }    },    methods: {refresh(loaded) {fetchDataList()        .then((res)=> {this.dataList=res.data.dataListloaded('done')        })      }    }  }</script>

The component will occupy 100% height of the parent element by default. props top-load-method and bottom-load-method will default to a loaded parameter, which is a function that changes the state of the component's load, and must be called once loaded. The component will always be loaded, ifloaded('done') The internal state of the component will become a successful state of loading,loaded('fail') for the failure.

More usage examples

API Docs

props

AttributeDescriptiontypeDefault
distance-indexSlip the threshold (the greater the value the slower the sliding)Number2
top-block-heightThe height of the block element area outside the top of the scroll containerNumber50
bottom-block-heightThe height of the block element area outside the scrolling containerNumber50
wrapper-heightThe height of the scrolling containerString'100%'
top-load-methodTop drop-down methodFunction
bottom-load-methodBottom pull-up methodFunction
is-throttle-top-pullWhether the disable of thetop-pull throttle event is triggered to ensure performance if the real-time trigger is set to falseBooleantrue
is-throttle-bottom-pullWhether the disable of thebottom-pull throttle event is triggered to ensure performance if the real-time trigger is set to falseBooleantrue
is-throttle-scrollWhether the disable of thescroll throttle event is triggered to ensure performance if the real-time trigger is set to falseBooleantrue
is-touch-sensitiveWhether to handle touch eventsBooleantrue
is-scroll-sensitiveWhether to handle scroll eventsBooleantrue
is-top-bounceWhether to enable the pull-down bounce effectBooleantrue
is-bottom-bounceWhether to enable the pull-up bounce effectBooleantrue
is-bottom-keep-scrollWhether to make the scroll container stay in place after completing the pull-down methodBooleanfalse
top-configConfiguration for the topmost part of the scroll containerObjectdefault config
bottom-configConfiguration for the bottommost part of the scroll containerObjectdefault config

topConfig andbottomConfig Configurable options and default configuration item values

constTOP_DEFAULT_CONFIG={pullText:'下拉刷新',// The text is displayed when you pull downtriggerText:'释放更新',// The text that appears when the trigger distance is pulled downloadingText:'加载中...',// The text in the loaddoneText:'加载完成',// Load the finished textfailText:'加载失败',// Load failed textloadedStayTime:400,// Time to stay after loading msstayDistance:50,// Trigger the distance after the refreshtriggerDistance:70// Pull down the trigger to trigger the distance}constBOTTOM_DEFAULT_CONFIG={pullText:'上拉加载',triggerText:'释放更新',loadingText:'加载中...',doneText:'加载完成',failText:'加载失败',loadedStayTime:400,stayDistance:50,triggerDistance:70}

slots

NameDescriptionscope
defaultThe default slot scrolls the contents of the container
top-blockScroll the contents of the top of the container outer (support the scope slot need to usetemplate tag with scopeattribute)state:Current state、state-text:State corresponding to the text
bottom-blockScroll the contents of the bottom of the container outer (support the scope slot need to usetemplate tag with scopeattribute)state:Current state、state-text:State corresponding to the text

events

nameDescription
top-state-changeWhen the top state has changed, the first parameter is the current state
bottom-state-changeWhen the bottom state has changed, the first parameter is the current state
top-pullPull down the trigger, the first parameter for the current pull of the distance value, the default will be throttle, configisThrottle to real-time trigger
bottom-pullPull up the trigger, the first parameter for the current pull of the distance value, the default will be throttle, configisThrottle to real-time trigger
infinite-scrollTriggered when the scroll container scrolls to the end
scrollWhen scrolling, the event callback function, the first parameter, is the nativeevent object

About

⚡️ A pull-down refresh and pull-up load more and infinite scroll component for Vue.js --Vue下拉刷新组件

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp