1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([[32],{439:function(e,t,o){"use strict";var s=o(435),i=function(){function e(e){this.scroll=e,this.wheelEndTimer=0,this.wheelMoveTimer=0,this.wheelStart=!1,this.init()}return e.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.registerEvent()},e.prototype.handleBScroll=function(){this.scroll.registerType(["alterOptions","mousewheelStart","mousewheelMove","mousewheelEnd"])},e.prototype.handleOptions=function(){var e=!0===this.scroll.options.mouseWheel?{}:this.scroll.options.mouseWheel;this.mouseWheelOpt=Object(s.t)({speed:20,invert:!1,easeTime:300,discreteTime:400,throttleTime:0,dampingFactor:.1},e)},e.prototype.handleHooks=function(){this.hooksFn=[],this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},e.prototype.registerEvent=function(){this.eventRegister=new s.f(this.scroll.scroller.wrapper,[{name:"wheel",handler:this.wheelHandler.bind(this)},{name:"mousewheel",handler:this.wheelHandler.bind(this)},{name:"DOMMouseScroll",handler:this.wheelHandler.bind(this)}])},e.prototype.registerHooks=function(e,t,o){e.on(t,o,this),this.hooksFn.push([e,t,o])},e.prototype.wheelHandler=function(e){if(this.scroll.enabled){this.beforeHandler(e),this.wheelStart||(this.wheelStartHandler(e),this.wheelStart=!0);var t=this.getWheelDelta(e);this.wheelMoveHandler(t),this.wheelEndDetector(t)}},e.prototype.wheelStartHandler=function(e){this.cleanCache();var t=this.scroll.scroller,o=t.scrollBehaviorX,i=t.scrollBehaviorY;o.setMovingDirection(s.b.Default),i.setMovingDirection(s.b.Default),o.setDirection(s.b.Default),i.setDirection(s.b.Default),this.scroll.trigger(this.scroll.eventTypes.alterOptions,this.mouseWheelOpt),this.scroll.trigger(this.scroll.eventTypes.mousewheelStart)},e.prototype.cleanCache=function(){this.deltaCache=[]},e.prototype.wheelMoveHandler=function(e){var t=this,o=this.mouseWheelOpt,s=o.throttleTime,i=o.dampingFactor;if(s&&this.wheelMoveTimer)this.deltaCache.push(e);else{var l=this.deltaCache.reduce((function(e,t){return{x:e.x+t.x,y:e.y+t.y}}),{x:0,y:0});this.cleanCache();var r=this.scroll.scroller,n=r.scrollBehaviorX,a=r.scrollBehaviorY;n.setMovingDirection(-e.directionX),a.setMovingDirection(-e.directionY),n.setDirection(e.x),a.setDirection(e.y);var h=n.performDampingAlgorithm(Math.round(e.x)+l.x,i),c=a.performDampingAlgorithm(Math.round(e.y)+l.x,i);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:h,y:c})){var p=this.getEaseTime();h===this.scroll.x&&c===this.scroll.y||this.scroll.scrollTo(h,c,p)}s&&(this.wheelMoveTimer=window.setTimeout((function(){t.wheelMoveTimer=0}),s))}},e.prototype.wheelEndDetector=function(e){var t=this;window.clearTimeout(this.wheelEndTimer),this.wheelEndTimer=window.setTimeout((function(){t.wheelStart=!1,window.clearTimeout(t.wheelMoveTimer),t.wheelMoveTimer=0,t.scroll.trigger(t.scroll.eventTypes.mousewheelEnd,e)}),this.mouseWheelOpt.discreteTime)},e.prototype.getWheelDelta=function(e){var t=this.mouseWheelOpt,o=t.speed,i=0,l=0,r=t.invert?s.b.Negative:s.b.Positive;switch(!0){case"deltaX"in e:1===e.deltaMode?(i=-e.deltaX*o,l=-e.deltaY*o):(i=-e.deltaX,l=-e.deltaY);break;case"wheelDeltaX"in e:i=e.wheelDeltaX/120*o,l=e.wheelDeltaY/120*o;break;case"wheelDelta"in e:i=l=e.wheelDelta/120*o;break;case"detail"in e:i=l=-e.detail/3*o}return i*=r,l*=r,this.scroll.hasVerticalScroll||(Math.abs(l)>Math.abs(i)&&(i=l),l=0),this.scroll.hasHorizontalScroll||(i=0),{x:i,y:l,directionX:i>0?s.b.Negative:i<0?s.b.Positive:s.b.Default,directionY:l>0?s.b.Negative:l<0?s.b.Positive:s.b.Default}},e.prototype.beforeHandler=function(e){var t=this.scroll.options,o=t.preventDefault,i=t.stopPropagation,l=t.preventDefaultException;o&&!Object(s.L)(e.target,l)&&Object(s.H)(e),i&&e.stopPropagation()},e.prototype.getEaseTime=function(){var e=this.mouseWheelOpt.easeTime;return e<100&&Object(s.S)("easeTime should be greater than 100.If mouseWheel easeTime is too small,scrollEnd will be triggered many times."),Math.max(e,100)},e.prototype.destroy=function(){this.eventRegister.destroy(),window.clearTimeout(this.wheelEndTimer),window.clearTimeout(this.wheelMoveTimer),this.hooksFn.forEach((function(e){var t=e[0],o=e[1],s=e[2];t.off(o,s)}))},e.pluginName="mouseWheel",e.applyOrder=s.a.Pre,e}();t.a=i},444:function(e,t,o){"use strict";var s=o(435),i=[{key:"finishPullUp",name:"finishPullUp"},{key:"openPullUp",name:"openPullUp"},{key:"closePullUp",name:"closePullUp"},{key:"autoPullUpLoad",name:"autoPullUpLoad"}].map((function(e){return{key:e.key,sourceKey:"plugins.pullUpLoad."+e.name}})),l=function(){function e(e){this.scroll=e,this.pulling=!1,this.watching=!1,this.init()}return e.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullUpLoad),this.handleHooks(),this.watch()},e.prototype.handleBScroll=function(){this.scroll.registerType(["pullingUp"]),this.scroll.proxy(i)},e.prototype.handleOptions=function(e){void 0===e&&(e={}),e=!0===e?{}:e;this.options=Object(s.t)({threshold:0},e),this.scroll.options.probeType=s.j.Realtime},e.prototype.handleHooks=function(){var e=this;this.hooksFn=[];var t=this.scroll.scroller.scrollBehaviorY;this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,(function(){e.finishPullUp()})),this.registerHooks(t.hooks,t.hooks.eventTypes.computeBoundary,(function(e){e.maxScrollPos>0&&(e.maxScrollPos=-1)}))},e.prototype.registerHooks=function(e,t,o){e.on(t,o,this),this.hooksFn.push([e,t,o])},e.prototype.watch=function(){this.watching||(this.watching=!0,this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkPullUp))},e.prototype.unwatch=function(){this.watching=!1,this.scroll.off(this.scroll.eventTypes.scroll,this.checkPullUp)},e.prototype.checkPullUp=function(e){var t=this,o=this.options.threshold;this.scroll.movingDirectionY===s.b.Positive&&e.y<=this.scroll.maxScrollY+o&&(this.pulling=!0,this.scroll.once(this.scroll.eventTypes.scrollEnd,(function(){t.pulling=!1})),this.unwatch(),this.scroll.trigger("pullingUp"))},e.prototype.finishPullUp=function(){var e=this;this.scroll.scroller.scrollBehaviorY.setMovingDirection(s.b.Default),this.pulling?this.scroll.once(this.scroll.eventTypes.scrollEnd,(function(){e.watch()})):this.watch()},e.prototype.openPullUp=function(e){void 0===e&&(e={}),this.handleOptions(e),this.watch()},e.prototype.closePullUp=function(){this.unwatch()},e.prototype.autoPullUpLoad=function(){var e=this.options.threshold,t=this.scroll.scroller.scrollBehaviorY;if(!this.pulling&&this.watching){var o=t.maxScrollPos+e+-1;this.scroll.scroller.scrollBehaviorY.setMovingDirection(-1),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime)}},e.pluginName="pullUpLoad",e}();t.a=l},527:function(e,t,o){},686:function(e,t,o){"use strict";o(527)},751:function(e,t,o){"use strict";o.r(t);var s=o(44),i=o(85),l=(o(11),o(436)),r=o(444),n=o(439);l.a.use(r.a),l.a.use(n.a);var a={data:function(){return{isPullUpLoad:!1,data:30}},mounted:function(){this.initBscroll()},methods:{initBscroll:function(){this.scroll=new l.a(this.$refs.scroll,{probeType:3,pullUpLoad:!0,mouseWheel:!0}),this.scroll.on("pullingUp",this.pullingUpHandler)},pullingUpHandler:function(){var e=this;return Object(i.a)(Object(s.a)().mark((function t(){return Object(s.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isPullUpLoad=!0,t.next=3,e.requestData();case 3:e.scroll.finishPullUp(),e.scroll.refresh(),e.isPullUpLoad=!1;case 6:case"end":return t.stop()}}),t)})))()},requestData:function(){var e=this;return Object(i.a)(Object(s.a)().mark((function t(){var o;return Object(s.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.ajaxGet();case 3:o=t.sent,e.data+=o,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.log(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))()},ajaxGet:function(){return new Promise((function(e){setTimeout((function(){e(20)}),1e3)}))}}},h=(o(686),o(41)),c=Object(h.a)(a,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"mouse-wheel-pullup"},[t("div",{ref:"scroll",staticClass:"pullup-wrapper"},[t("div",{staticClass:"pullup-content"},[t("ul",{staticClass:"pullup-list"},e._l(e.data,(function(o){return t("li",{key:o,staticClass:"pullup-list-item"},[e._v("\n "+e._s(o%5==0?"use your mousewheel please 👆🏻":"I am item ".concat(o," "))+"\n ")])})),0),e._v(" "),t("div",{staticClass:"pullup-tips"},[e.isPullUpLoad?t("div",{staticClass:"after-trigger"},[t("span",{staticClass:"pullup-txt"},[e._v("Loading...")])]):t("div",{staticClass:"before-trigger"},[t("span",{staticClass:"pullup-txt"},[e._v("mousewheel trigger pullingup and load more")])])])])])])}),[],!1,null,"070b2528",null);t.default=c.exports}}]);
|