vue-slim-better-scroll
Version:
💇 开箱即用的/渐进式的 vue 移动端滚动组件
7 lines (6 loc) • 22.8 kB
JavaScript
/*!
* vue-slim-better-scroll v1.7.3
* Copyright (c) 2018-present, komo <ko.momo@qq.com>
* Released under the MIT License.
*/
"use strict";var t,e=(t=require("better-scroll"))&&"object"==typeof t&&"default"in t?t.default:t;var r=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};var n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),o.forEach(function(e){r(t,e,n[e])})}return t};var o=function(t,e){return t(e={exports:{}},e.exports),e.exports}(function(t){!function(e){var r,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},l=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag",u=e.regeneratorRuntime;if(u)t.exports=u;else{(u=e.regeneratorRuntime=t.exports).wrap=w;var c="suspendedStart",h="suspendedYield",p="executing",f="completed",d={},m={};m[l]=function(){return this};var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==n&&o.call(g,l)&&(m=g);var v=D.prototype=x.prototype=Object.create(m);_.prototype=v.constructor=D,D.constructor=_,D[s]=_.displayName="GeneratorFunction",u.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,D):(t.__proto__=D,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(v),t},u.awrap=function(t){return{__await:t}},C(U.prototype),U.prototype[a]=function(){return this},u.AsyncIterator=U,u.async=function(t,e,r,n){var o=new U(w(t,e,r,n));return u.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},C(v),v[s]="Generator",v[l]=function(){return this},v.toString=function(){return"[object Generator]"},u.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},u.values=E,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return a.type="throw",a.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var l=this.tryEntries[i],a=l.completion;if("root"===l.tryLoc)return n("end");if(l.tryLoc<=this.prev){var s=o.call(l,"catchLoc"),u=o.call(l,"finallyLoc");if(s&&u){if(this.prev<l.catchLoc)return n(l.catchLoc,!0);if(this.prev<l.finallyLoc)return n(l.finallyLoc)}else if(s){if(this.prev<l.catchLoc)return n(l.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return n(l.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var l=i?i.completion:{};return l.type=t,l.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(l)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}}}function w(t,e,r,n){var o=e&&e.prototype instanceof x?e:x,i=Object.create(o.prototype),l=new R(n||[]);return i._invoke=function(t,e,r){var n=c;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===f){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var a=k(l,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===c)throw n=f,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var s=b(t,e,r);if("normal"===s.type){if(n=r.done?f:h,s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=f,r.method="throw",r.arg=s.arg)}}}(t,r,l),i}function b(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function x(){}function _(){}function D(){}function C(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function U(t){var e;this._invoke=function(r,n){function i(){return new Promise(function(e,i){!function e(r,n,i,l){var a=b(t[r],t,n);if("throw"!==a.type){var s=a.arg,u=s.value;return u&&"object"==typeof u&&o.call(u,"__await")?Promise.resolve(u.__await).then(function(t){e("next",t,i,l)},function(t){e("throw",t,i,l)}):Promise.resolve(u).then(function(t){s.value=t,i(s)},function(t){return e("throw",t,i,l)})}l(a.arg)}(r,n,e,i)})}return e=e?e.then(i,i):i()}}function k(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,k(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=b(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function E(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:r,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())}),i=function(){return this||"object"==typeof self&&self}()||Function("return this")(),l=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,a=l&&i.regeneratorRuntime;i.regeneratorRuntime=void 0;var s=o;if(l)i.regeneratorRuntime=a;else try{delete i.regeneratorRuntime}catch(t){i.regeneratorRuntime=void 0}var u=s;function c(t,e,r,n,o,i,l){try{var a=t[i](l),s=a.value}catch(t){return void r(t)}a.done?e(s):Promise.resolve(s).then(n,o)}var h=function(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function l(t){c(i,n,o,l,a,"next",t)}function a(t){c(i,n,o,l,a,"throw",t)}l(void 0)})}},p="vue-slim-better-scroll",f={methods:{c:function(t){return t?"".concat(p).concat(t):"".concat(p)}}},d={name:"Loading",mixins:[f]};var m=function(t,e,r,n,o,i,l,a,s,u){"boolean"!=typeof l&&(s=a,a=l,l=!1);var c,h="function"==typeof r?r.options:r;if(t&&t.render&&(h.render=t.render,h.staticRenderFns=t.staticRenderFns,h._compiled=!0,o&&(h.functional=!0)),n&&(h._scopeId=n),i?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,s(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},h._ssrRegister=c):e&&(c=l?function(){e.call(this,u(this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(h.functional){var p=h.render;h.render=function(t,e){return c.call(e),p(t,e)}}else{var f=h.beforeCreate;h.beforeCreate=f?[].concat(f,c):[c]}return r},y="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var g=document.head||document.getElementsByTagName("head")[0],v={};var w=function(t){return function(t,e){return function(t,e){var r=y?e.media||"default":t,n=v[r]||(v[r]={ids:new Set,styles:[]});if(!n.ids.has(t)){n.ids.add(t);var o=e.source;if(e.map&&(o+="\n/*# sourceURL="+e.map.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",e.media&&n.element.setAttribute("media",e.media),g.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(o),n.element.styleSheet.cssText=n.styles.filter(Boolean).join("\n");else{var i=n.ids.size-1,l=document.createTextNode(o),a=n.element.childNodes;a[i]&&n.element.removeChild(a[i]),a.length?n.element.insertBefore(l,a[i]):n.element.appendChild(l)}}}(t,e)}};var b=m({render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{class:this.c("__loading")},this._l(12,function(t){return e("i",{key:t})}),0)},staticRenderFns:[]},function(t){t&&t("data-v-9479dd72_0",{source:".vue-slim-better-scroll__loading{width:20px;height:20px;position:relative;display:block;box-sizing:border-box;-webkit-animation:spinner-rotate 1s linear infinite;animation:spinner-rotate 1s linear infinite;-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12);color:#8c8c8c}.vue-slim-better-scroll__loading i{top:0;left:0;width:100%;height:100%;position:absolute}.vue-slim-better-scroll__loading i::before{width:9%;height:25%;content:'';display:block;margin:0 auto;border-radius:10px;background-color:currentColor}.vue-slim-better-scroll__loading i:nth-of-type(1){opacity:1;-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);transform:rotate(30deg)}.vue-slim-better-scroll__loading i:nth-of-type(2){opacity:.9375;-webkit-transform:rotate(60deg);-ms-transform:rotate(60deg);transform:rotate(60deg)}.vue-slim-better-scroll__loading i:nth-of-type(3){opacity:.875;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.vue-slim-better-scroll__loading i:nth-of-type(4){opacity:.8125;-webkit-transform:rotate(120deg);-ms-transform:rotate(120deg);transform:rotate(120deg)}.vue-slim-better-scroll__loading i:nth-of-type(5){opacity:.75;-webkit-transform:rotate(150deg);-ms-transform:rotate(150deg);transform:rotate(150deg)}.vue-slim-better-scroll__loading i:nth-of-type(6){opacity:.6875;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.vue-slim-better-scroll__loading i:nth-of-type(7){opacity:.625;-webkit-transform:rotate(210deg);-ms-transform:rotate(210deg);transform:rotate(210deg)}.vue-slim-better-scroll__loading i:nth-of-type(8){opacity:.5625;-webkit-transform:rotate(240deg);-ms-transform:rotate(240deg);transform:rotate(240deg)}.vue-slim-better-scroll__loading i:nth-of-type(9){opacity:.5;-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.vue-slim-better-scroll__loading i:nth-of-type(10){opacity:.4375;-webkit-transform:rotate(300deg);-ms-transform:rotate(300deg);transform:rotate(300deg)}.vue-slim-better-scroll__loading i:nth-of-type(11){opacity:.375;-webkit-transform:rotate(330deg);-ms-transform:rotate(330deg);transform:rotate(330deg)}.vue-slim-better-scroll__loading i:nth-of-type(12){opacity:.3125;-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}@-webkit-keyframes spinner-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}",map:void 0,media:void 0})},d,void 0,!1,void 0,w,void 0);var x=m({render:function(){var t=this.$createElement;return(this._self._c||t)("canvas",{ref:"bubble",style:this.style,attrs:{width:this.width,height:this.height}})},staticRenderFns:[]},void 0,{props:{y:{type:Number,default:0}},data:function(){return{width:50,height:80}},computed:{distance:function(){return Math.max(0,Math.min(this.y*this.ratio,this.maxDistance))},style:function(){return"width:".concat(this.width/this.ratio,"px;height:").concat(this.height/this.ratio,"px")}},watch:{y:function(){this._draw()}},created:function(){this.ratio=window.devicePixelRatio,this.width*=this.ratio,this.height*=this.ratio,this.initRadius=18*this.ratio,this.minHeadRadius=12*this.ratio,this.minTailRadius=5*this.ratio,this.initArrowRadius=10*this.ratio,this.minArrowRadius=6*this.ratio,this.arrowWidth=3*this.ratio,this.maxDistance=40*this.ratio,this.initCenterX=25*this.ratio,this.initCenterY=25*this.ratio,this.headCenter={x:this.initCenterX,y:this.initCenterY}},mounted:function(){this._draw()},methods:{_draw:function(){var t=this.$refs.bubble,e=t.getContext("2d");e.clearRect(0,0,t.width,t.height),this._drawBubble(e),this._drawArrow(e)},_drawBubble:function(t){t.save(),t.beginPath();var e=this.distance/this.maxDistance,r=this.initRadius-(this.initRadius-this.minHeadRadius)*e;this.headCenter.y=this.initCenterY-(this.initRadius-this.minHeadRadius)*e,t.arc(this.headCenter.x,this.headCenter.y,r,0,Math.PI,!0);var n=this.initRadius-(this.initRadius-this.minTailRadius)*e,o={x:this.headCenter.x,y:this.headCenter.y+this.distance},i={x:o.x-n,y:o.y},l={x:i.x,y:i.y-this.distance/2};t.quadraticCurveTo(l.x,l.y,i.x,i.y),t.arc(o.x,o.y,n,Math.PI,0,!0);var a={x:this.headCenter.x+r,y:this.headCenter.y},s={x:o.x+n,y:a.y+this.distance/2};t.quadraticCurveTo(s.x,s.y,a.x,a.y),t.fillStyle="rgb(170,170,170)",t.fill(),t.strokeStyle="rgb(153,153,153)",t.stroke(),t.restore()},_drawArrow:function(t){t.save(),t.beginPath();var e=this.distance/this.maxDistance,r=this.initArrowRadius-(this.initArrowRadius-this.minArrowRadius)*e;t.arc(this.headCenter.x,this.headCenter.y,r-(this.arrowWidth-e),-Math.PI/2,0,!0),t.arc(this.headCenter.x,this.headCenter.y,r,0,3*Math.PI/2,!1),t.lineTo(this.headCenter.x,this.headCenter.y-r-this.arrowWidth/2+e),t.lineTo(this.headCenter.x+2*this.arrowWidth-2*e,this.headCenter.y-r+this.arrowWidth/2),t.lineTo(this.headCenter.x,this.headCenter.y-r+3*this.arrowWidth/2-e),t.fillStyle="rgb(255,255,255)",t.fill(),t.strokeStyle="rgb(170,170,170)",t.stroke(),t.restore()}}},void 0,!1,void 0,void 0,void 0);function _(t){return new Promise(function(e){setTimeout(e,t)})}var D=m({render:function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{ref:"scroll",class:t.c()},[r("div",{class:t.c("__wrapper")},[r("div",{ref:"scrollContent"},[t._t("default")],2),t._v(" "),t._t("pullup",[t.pullUp?r("div",{class:t.c("__pullup")},[t.pullUpNow?r("div",[r("Loading")],1):r("div",[r("span",[t._v(t._s(t.pullUpTxt))])])]):t._e()],{pullUp:t.pullUp,pullUpNow:t.pullUpNow})],2),t._v(" "),t._t("pulldown",[t.pullDown?r("div",{ref:"pulldown",class:t.c("__pulldown"),style:t.pullDownStyle},[t.pullDownBefore?r("div",{class:t.c("__pulldown__before")},[r("Bubble",{attrs:{y:t.bubbleY}})],1):r("div",{class:t.c("__pulldown__after")},[t.pullDownNow?r("div",[r("Loading")],1):r("div",[r("span",[t._v(t._s(t.pullDownTxt))])])])]):t._e()],{pullDown:t.pullDown,pullDownStyle:t.pullDownStyle,pullDownBefore:t.pullDownBefore,pullDownNow:t.pullDownNow,bubbleY:t.bubbleY})],2)},staticRenderFns:[]},function(t){t&&t("data-v-b236095e_0",{source:".vue-slim-better-scroll{width:100%;height:100%;overflow:hidden;box-sizing:border-box;position:relative}.vue-slim-better-scroll__wrapper{position:relative;z-index:1}.vue-slim-better-scroll__pullup{width:100%;height:50px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;font-size:14px;color:#999}.vue-slim-better-scroll__pulldown{position:absolute;left:0;top:-50px;width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;transition:all;font-size:14px;color:#999}.vue-slim-better-scroll__pulldown__before{display:-ms-flexbox;display:flex}.vue-slim-better-scroll__pulldown__after{width:100%;height:40px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}",map:void 0,media:void 0})},{name:"Scroll",components:{Loading:b,Bubble:x},mixins:[f],props:{probeType:{type:Number,default:1},click:{type:Boolean,default:!0},listenScroll:{type:Boolean,default:!1},listenBeforeScrollStart:{type:Boolean,default:!1},scrollX:{type:Boolean,default:!1},scrollY:{type:Boolean,default:!0},scrollbar:{type:null,default:!1},pullDown:{type:Boolean,default:!0},pullDownConfig:{type:Object,default:function(){return{threshold:90,stop:40,txt:"\u5237\u65b0\u6210\u529f"}}},pullUp:{type:Boolean,default:!0},pullUpConfig:{type:Object,default:function(){return{threshold:100,txt:{more:"\u4e0a\u62c9\u52a0\u8f7d",noMore:"\u2014 \u6211\u662f\u6709\u5e95\u7ebf\u7684 \u2014"}}}},startY:{type:Number,default:0},bounce:{type:Boolean,default:!0},bounceTime:{type:Number,default:600},preventDefaultException:{type:Object,default:function(){return{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/}}},mouseWheel:{type:Boolean,default:!1},betterScrollOptions:{type:Object,default:null},autoUpdate:{type:Boolean,default:!1},updateData:{type:Array,default:null},refreshData:{type:Array,default:null}},data:function(){return{pullDownBefore:!0,pullDownNow:!1,pullDownStyle:"",pullUpNow:!1,pullUpFinally:!1,isRebounding:!1,bubbleY:0}},computed:{pullDownTxt:function(){return this.pullDownConfig&&this.pullDownConfig.txt},pullUpTxt:function(){var t=this.pullUpConfig&&this.pullUpConfig.txt&&this.pullUpConfig.txt.more,e=this.pullUpConfig&&this.pullUpConfig.txt&&this.pullUpConfig.txt.noMore;return this.pullUpFinally?e:t}},watch:{updateData:function(){this.update()},refreshData:function(){var t=h(u.mark(function t(){return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.pullDownUpdateState&&!this.pullUpUpdateState){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.$nextTick();case 4:this.refresh();case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},activated:function(){this.refresh()},mounted:function(){var t=h(u.mark(function t(){var e=this;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.pullDownInitTop=parseInt(this.$refs.pulldown&&getComputedStyle(this.$refs.pulldown).top)||-50,t.next=3,this.$nextTick();case 3:this.initScroll(),this.autoUpdate&&this.$parent&&this.$parent.$data&&this.$watch(function(){return e.$parent.$data},function(t){e.update()},{deep:!0});case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),methods:{initScroll:function(){var t=this;if(this.$refs.scroll){this.$refs.scrollContent&&(this.$refs.scrollContent.style.minHeight="".concat(this.$refs.scroll.getBoundingClientRect().height+1,"px"));var r=n({},this.betterScrollOptions,{probeType:this.probeType,click:this.click,scrollX:this.scrollX,scrollY:this.scrollY,scrollbar:this.scrollbar,pullDownRefresh:this.pullDown&&this.pullDownConfig,pullUpLoad:this.pullUp&&this.pullUpConfig,startY:this.startY,bounce:this.bounce,bounceTime:this.bounceTime,preventDefaultException:this.preventDefaultException,mouseWheel:this.mouseWheel});this.scroll=new e(this.$refs.scroll,r),this.listenScroll&&this.scroll.on("scroll",function(e){t.$emit("scroll",e)}),this.listenBeforeScrollStart&&this.scroll.on("beforeScrollStart",function(){t.$emit("beforeScrollStart")}),this.pullDown&&this._initPullDown(),this.pullUp&&this._initPullUp()}},_initPullDown:function(){var t=this;this.scroll.on("pullingDown",function(){t.pullDownBefore=!1,t.pullDownNow=!0,t.$emit("pullingDown"),t.scroll.closePullDown()}),this.scroll.on("scroll",function(e){if(t.pullDown&&!(e.y<0)){var r=Math.floor(e.y);t.pullDownBefore?(t.bubbleY=Math.max(0,r+t.pullDownInitTop),t.pullDownStyle="transform: translateY(".concat(Math.min(r,-t.pullDownInitTop),"px)")):t.bubbleY=0,t.isRebounding&&(t.pullDownStyle="transform: translateY(".concat(Math.min(r,t.pullDownConfig.stop),"px)"))}})},_initPullUp:function(){var t=this;this.scroll.on("pullingUp",function(){t.pullUpFinally?t.scroll.finishPullUp():(t.pullUpNow=!0,t.$emit("pullingUp"))})},disable:function(){this.scroll&&this.scroll.disable()},enable:function(){this.scroll&&this.scroll.enable()},destroy:function(){this.scroll&&this.scroll.destroy()},refresh:function(){this.scroll&&this.scroll.refresh()},update:function(){var t=h(u.mark(function t(e){return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.pullDown||!this.pullDownNow){t.next=17;break}if(!this.pullDownUpdateState){t.next=3;break}return t.abrupt("return");case 3:return this.pullDownUpdateState=!0,this.pullDownNow=!1,t.next=7,_(this.bounceTime/2);case 7:return this.isRebounding=!0,this.scroll.finishPullDown(),t.next=11,_(this.bounceTime);case 11:this.pullDownBefore=!0,this.isRebounding=!1,this.scroll.openPullDown(this.pullDownConfig),this.pullUpFinally=!1,t.next=23;break;case 17:if(!this.pullUp||!this.pullUpNow){t.next=23;break}if(!this.pullUpUpdateState){t.next=20;break}return t.abrupt("return");case 20:this.pullUpUpdateState=!0,this.pullUpNow=!1,this.scroll.finishPullUp();case 23:return void 0!==e&&(this.pullUpFinally=!!e),t.next=26,this.$nextTick();case 26:this.refresh(),this.pullDownUpdateState=!1,this.pullUpUpdateState=!1;case 29:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),scrollTo:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.bounceTime;this.scroll&&this.scroll.scrollTo(t,e,r)},scrollToElement:function(){this.scroll&&this.scroll.scrollToElement.apply(this.scroll,arguments)},scrollToTop:function(){this.scroll&&this.scrollTo(0,0)},scrollToBottom:function(){this.scroll&&this.scrollTo(0,this.scroll.maxScrollY)},autoPullDownRefresh:function(){this.scroll&&this.scroll.autoPullDownRefresh()}}},void 0,!1,void 0,w,void 0);D.install=function(t){t.component(D.name,D)},module.exports=D;