31.af4018f6.js 12 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[31],{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,h=r.scrollBehaviorY;n.setMovingDirection(-e.directionX),h.setMovingDirection(-e.directionY),n.setDirection(e.x),h.setDirection(e.y);var c=n.performDampingAlgorithm(Math.round(e.x)+l.x,i),a=h.performDampingAlgorithm(Math.round(e.y)+l.x,i);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:c,y:a})){var u=this.getEaseTime();c===this.scroll.x&&a===this.scroll.y||this.scroll.scrollTo(c,a,u)}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},445:function(e,t,o){"use strict";var s,i,l=o(435),r=[{key:"finishPullDown",name:"finishPullDown"},{key:"openPullDown",name:"openPullDown"},{key:"closePullDown",name:"closePullDown"},{key:"autoPullDownRefresh",name:"autoPullDownRefresh"}].map((function(e){return{key:e.key,sourceKey:"plugins.pullDownRefresh."+e.name}}));!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.MOVING=1]="MOVING",e[e.FETCHING=2]="FETCHING"}(s||(s={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.INSIDE=1]="INSIDE",e[e.OUTSIDE=2]="OUTSIDE"}(i||(i={}));var n=function(){function e(e){this.scroll=e,this.pulling=s.DEFAULT,this.thresholdBoundary=i.DEFAULT,this.init()}return e.prototype.setPulling=function(e){this.pulling=e},e.prototype.setThresholdBoundary=function(e){this.thresholdBoundary=e},e.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullDownRefresh),this.handleHooks(),this.watch()},e.prototype.handleBScroll=function(){this.scroll.registerType(["pullingDown","enterThreshold","leaveThreshold"]),this.scroll.proxy(r)},e.prototype.handleOptions=function(e){void 0===e&&(e={}),e=!0===e?{}:e;this.options=Object(l.t)({threshold:90,stop:40},e),this.scroll.options.probeType=l.j.Realtime},e.prototype.handleHooks=function(){var e=this;this.hooksFn=[];var t=this.scroll.scroller,o=t.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY=o.minScrollPos,this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,(function(){e.finishPullDown()})),this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,(function(t){t.maxScrollPos>0&&(t.maxScrollPos=-1),t.minScrollPos=e.currentMinScrollY})),this.hasMouseWheelPlugin()&&(this.registerHooks(this.scroll,this.scroll.eventTypes.alterOptions,(function(e){e.discreteTime=300,e.easeTime=350})),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,(function(){t.hooks.trigger(t.hooks.eventTypes.end)})))},e.prototype.registerHooks=function(e,t,o){e.on(t,o,this),this.hooksFn.push([e,t,o])},e.prototype.hasMouseWheelPlugin=function(){return!!this.scroll.eventTypes.alterOptions},e.prototype.watch=function(){var e=this.scroll.scroller;this.watching=!0,this.registerHooks(e.hooks,e.hooks.eventTypes.end,this.checkPullDown),this.registerHooks(this.scroll,this.scroll.eventTypes.scrollStart,this.resetStateBeforeScrollStart),this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkLocationOfThresholdBoundary),this.hasMouseWheelPlugin()&&this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelStart,this.resetStateBeforeScrollStart)},e.prototype.resetStateBeforeScrollStart=function(){this.isFetchingStatus()||(this.setPulling(s.MOVING),this.setThresholdBoundary(i.DEFAULT))},e.prototype.checkLocationOfThresholdBoundary=function(){if(this.pulling===s.MOVING){var e=this.scroll,t=this.thresholdBoundary!==i.INSIDE&&this.locateInsideThresholdBoundary(),o=this.thresholdBoundary!==i.OUTSIDE&&!this.locateInsideThresholdBoundary();t&&(this.setThresholdBoundary(i.INSIDE),e.trigger("enterThreshold")),o&&(this.setThresholdBoundary(i.OUTSIDE),e.trigger("leaveThreshold"))}},e.prototype.locateInsideThresholdBoundary=function(){return this.scroll.y<=this.options.threshold},e.prototype.unwatch=function(){var e=this.scroll,t=e.scroller;this.watching=!1,t.hooks.off(t.hooks.eventTypes.end,this.checkPullDown),e.off(e.eventTypes.scrollStart,this.resetStateBeforeScrollStart),e.off(e.eventTypes.scroll,this.checkLocationOfThresholdBoundary),this.hasMouseWheelPlugin()&&e.off(e.eventTypes.mousewheelStart,this.resetStateBeforeScrollStart)},e.prototype.checkPullDown=function(){var e=this.options,t=e.threshold,o=e.stop;return!(this.scroll.y<t)&&(this.pulling===s.MOVING&&(this.modifyBehaviorYBoundary(o),this.setPulling(s.FETCHING),this.scroll.trigger("pullingDown")),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,l.r.bounce),this.isFetchingStatus())},e.prototype.isFetchingStatus=function(){return this.pulling===s.FETCHING},e.prototype.modifyBehaviorYBoundary=function(e){var t=this.scroll.scroller.scrollBehaviorY;this.cachedOriginanMinScrollY=t.minScrollPos,this.currentMinScrollY=e,t.computeBoundary()},e.prototype.finishPullDown=function(){if(this.isFetchingStatus()){var e=this.scroll.scroller.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY,e.computeBoundary(),this.setPulling(s.DEFAULT),this.scroll.resetPosition(this.scroll.options.bounceTime,l.r.bounce)}},e.prototype.openPullDown=function(e){void 0===e&&(e={}),this.handleOptions(e),this.watching||this.watch()},e.prototype.closePullDown=function(){this.unwatch()},e.prototype.autoPullDownRefresh=function(){var e=this.options,t=e.threshold,o=e.stop;!this.isFetchingStatus()&&this.watching&&(this.modifyBehaviorYBoundary(o),this.scroll.trigger(this.scroll.eventTypes.scrollStart),this.scroll.scrollTo(this.scroll.x,t),this.setPulling(s.FETCHING),this.scroll.trigger("pullingDown"),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,l.r.bounce))},e.pluginName="pullDownRefresh",e}();t.a=n},526:function(e,t,o){},685:function(e,t,o){"use strict";o(526)},750:function(e,t,o){"use strict";o.r(t);var s=o(44),i=o(85),l=(o(252),o(112),o(11),o(436)),r=o(445),n=o(439);function h(){for(var e=30*c,t=[],o=30*(c+1);o>e;o--)t.push(o);return t}l.a.use(r.a),l.a.use(n.a);var c=0,a={data:function(){return{beforePullDown:!0,isPullingDown:!1,dataList:h()}},mounted:function(){this.initBscroll()},methods:{initBscroll:function(){this.bscroll=new l.a(this.$refs.scroll,{scrollY:!0,bounceTime:800,mouseWheel:!0,pullDownRefresh:{threshold:70,stop:56}}),this.bscroll.on("pullingDown",this.pullingDownHandler),this.bscroll.on("scroll",this.scrollHandler),this.bscroll.on("scrollEnd",(function(e){console.log("scrollEnd")}))},scrollHandler:function(e){console.log(e.y)},pullingDownHandler: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 console.log("trigger pullDown"),e.beforePullDown=!1,e.isPullingDown=!0,c+=1,t.next=6,e.requestData();case 6:e.isPullingDown=!1,e.finishPullDown();case 8:case"end":return t.stop()}}),t)})))()},finishPullDown: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 600,t.next=3,new Promise((function(t){setTimeout((function(){e.bscroll.finishPullDown(),t()}),600)}));case 3:setTimeout((function(){e.beforePullDown=!0,e.bscroll.refresh()}),800);case 4: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.dataList=o.concat(e.dataList),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(){var t=h();e(t)}),1e3)}))}}},u=(o(685),o(41)),p=Object(u.a)(a,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"mouse-wheel-pulldown"},[t("div",{ref:"scroll",staticClass:"pulldown-wrapper"},[t("div",{staticClass:"pulldown-content"},[t("div",{staticClass:"pulldown-tips"},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.beforePullDown,expression:"beforePullDown"}]},[t("span",[e._v("Pull Down and refresh")])]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.beforePullDown,expression:"!beforePullDown"}]},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.isPullingDown,expression:"isPullingDown"}]},[t("span",[e._v("Loading...")])]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.isPullingDown,expression:"!isPullingDown"}]},[t("span",[e._v("Refresh success")])])])]),e._v(" "),t("ul",{staticClass:"pulldown-list"},e._l(e.dataList,(function(o){return t("li",{key:o,staticClass:"pulldown-list-item"},[e._v("\n "+e._s("I am item ".concat(o," "))+"\n ")])})),0)])])])}),[],!1,null,"5dd66a23",null);t.default=p.exports}}]);