2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
|
import{a_ as o,s as t,h as e,i as n,H as s,n as i,l,L as r,aJ as p,P as c,Q as a,R as h,aq as d,a$ as u,D as w,w as g,j as f,J as m,K as y,S,k as D,v as T,t as x}from"./index-849cf30e.js";import{_ as U}from"./_plugin-vue_export-helper.1b428a4d.js";function b(o,t){let e=this;e.version="1.3.7",e.options=o||{},e.isScrollBody=t||!1,e.isDownScrolling=!1,e.isUpScrolling=!1;let n=e.options.down&&e.options.down.callback;e.initDownScroll(),e.initUpScroll(),setTimeout((function(){(e.optDown.use||e.optDown.native)&&e.optDown.auto&&n&&(e.optDown.autoShowLoading?e.triggerDownScroll():e.optDown.callback&&e.optDown.callback(e)),e.isUpAutoLoad||setTimeout((function(){e.optUp.use&&e.optUp.auto&&!e.isUpAutoLoad&&e.triggerUpScroll()}),100)}),30)}b.prototype.extendDownScroll=function(o){b.extend(o,{use:!0,auto:!0,native:!1,autoShowLoading:!1,isLock:!1,offset:80,startTop:100,inOffsetRate:1,outOffsetRate:.2,bottomOffset:20,minAngle:45,textInOffset:"下拉刷新",textOutOffset:"释放更新",textLoading:"加载中 ...",textSuccess:"加载成功",textErr:"加载失败",beforeEndDelay:0,bgColor:"transparent",textColor:"gray",inited:null,inOffset:null,outOffset:null,onMoving:null,beforeLoading:null,showLoading:null,afterLoading:null,beforeEndDownScroll:null,endDownScroll:null,afterEndDownScroll:null,callback:function(o){o.resetUpScroll()}})},b.prototype.extendUpScroll=function(o){b.extend(o,{use:!0,auto:!0,isLock:!1,isBoth:!0,callback:null,page:{num:0,size:10,time:null},noMoreSize:5,offset:150,textLoading:"加载中 ...",textNoMore:"-- END --",bgColor:"transparent",textColor:"gray",inited:null,showLoading:null,showNoMore:null,hideUpScroll:null,errDistance:60,toTop:{src:null,offset:1e3,duration:300,btnClick:null,onShow:null,zIndex:9990,left:null,right:20,bottom:120,safearea:!1,width:72,radius:"50%"},empty:{use:!0,icon:null,tip:"~ 暂无相关数据 ~",btnText:"",btnClick:null,onShow:null,fixed:!1,top:"100rpx",zIndex:99},onScroll:!1})},b.extend=function(o,t){if(!o)return t;for(let e in t)if(null==o[e]){let n=t[e];o[e]=null!=n&&"object"==typeof n?b.extend({},n):n}else"object"==typeof o[e]&&b.extend(o[e],t[e]);return o},b.prototype.hasColor=function(o){if(!o)return!1;let t=o.toLowerCase();return"#fff"!=t&&"#ffffff"!=t&&"transparent"!=t&&"white"!=t},b.prototype.initDownScroll=function(){let o=this;o.optDown=o.options.down||{},!o.optDown.textColor&&o.hasColor(o.optDown.bgColor)&&(o.optDown.textColor="#fff"),o.extendDownScroll(o.optDown),o.isScrollBody&&o.optDown.native?o.optDown.use=!1:o.optDown.native=!1,o.downHight=0,o.optDown.use&&o.optDown.inited&&setTimeout((function(){o.optDown.inited(o)}),0)},b.prototype.touchstartEvent=function(o){this.optDown.use&&(this.startPoint=this.getPoint(o),this.startTop=this.getScrollTop(),this.startAngle=0,this.lastPoint=this.startPoint,this.maxTouchmoveY=this.getBodyHeight()-this.optDown.bottomOffset,this.inTouchend=!1)},b.prototype.touchmoveEvent=function(o){if(!this.optDown.use)return;let t=this,e=t.getScrollTop(),n=t.getPoint(o);if(n.y-t.startPoint.y>0&&(t.isScrollBody&&e<=0||!t.isScrollBody&&(e<=0||e<=t.optDown.startTop&&e===t.startTop))&&!t.inTouchend&&!t.isDownScrolling&&!t.optDown.isLock&&(!t.isUpScrolling||t.isUpScrolling&&t.optUp.isBoth)){if(t.startAngle||(t.startAngle=t.getAngle(t.lastPoint,n)),t.startAngle<t.optDown.minAngle)return;if(t.maxTouchmoveY>0&&n.y>=t.maxTouchmoveY)return t.inTouchend=!0,void t.touchendEvent();t.preventDefault(o);let e=n.y-t.lastPoint.y;t.downHight<t.optDown.offset?(1!==t.movetype&&(t.movetype=1,t.isDownEndSuccess=null,t.optDown.inOffset&&t.optDown.inOffset(t),t.isMoveDown=!0),t.downHight+=e*t.optDown.inOffsetRate):(2!==t.movetype&&(t.movetype=2,t.optDown.outOffset&&t.optDown.outOffset(t),t.isMoveDown=!0),t.downHight+=e>0?e*t.optDown.outOffsetRate:e),t.downHight=Math.round(t.downHight);let s=t.downHight/t.optDown.offset;t.optDown.onMoving&&t.optDown.onMoving(t,s,t.downHight)}t.lastPoint=n},b.prototype.touchendEvent=function(o){if(this.optDown.use)if(this.isMoveDown)this.downHight>=this.optDown.offset?this.triggerDownScroll():(this.downHight=0,this.endDownScrollCall(this)),this.mo
|