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