19.a4034f95.js 12 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[19],{444:function(t,o,s){"use strict";var e=s(435),l=[{key:"finishPullUp",name:"finishPullUp"},{key:"openPullUp",name:"openPullUp"},{key:"closePullUp",name:"closePullUp"},{key:"autoPullUpLoad",name:"autoPullUpLoad"}].map((function(t){return{key:t.key,sourceKey:"plugins.pullUpLoad."+t.name}})),i=function(){function t(t){this.scroll=t,this.pulling=!1,this.watching=!1,this.init()}return t.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullUpLoad),this.handleHooks(),this.watch()},t.prototype.handleBScroll=function(){this.scroll.registerType(["pullingUp"]),this.scroll.proxy(l)},t.prototype.handleOptions=function(t){void 0===t&&(t={}),t=!0===t?{}:t;this.options=Object(e.t)({threshold:0},t),this.scroll.options.probeType=e.j.Realtime},t.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var o=this.scroll.scroller.scrollBehaviorY;this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,(function(){t.finishPullUp()})),this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,(function(t){t.maxScrollPos>0&&(t.maxScrollPos=-1)}))},t.prototype.registerHooks=function(t,o,s){t.on(o,s,this),this.hooksFn.push([t,o,s])},t.prototype.watch=function(){this.watching||(this.watching=!0,this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkPullUp))},t.prototype.unwatch=function(){this.watching=!1,this.scroll.off(this.scroll.eventTypes.scroll,this.checkPullUp)},t.prototype.checkPullUp=function(t){var o=this,s=this.options.threshold;this.scroll.movingDirectionY===e.b.Positive&&t.y<=this.scroll.maxScrollY+s&&(this.pulling=!0,this.scroll.once(this.scroll.eventTypes.scrollEnd,(function(){o.pulling=!1})),this.unwatch(),this.scroll.trigger("pullingUp"))},t.prototype.finishPullUp=function(){var t=this;this.scroll.scroller.scrollBehaviorY.setMovingDirection(e.b.Default),this.pulling?this.scroll.once(this.scroll.eventTypes.scrollEnd,(function(){t.watch()})):this.watch()},t.prototype.openPullUp=function(t){void 0===t&&(t={}),this.handleOptions(t),this.watch()},t.prototype.closePullUp=function(){this.unwatch()},t.prototype.autoPullUpLoad=function(){var t=this.options.threshold,o=this.scroll.scroller.scrollBehaviorY;if(!this.pulling&&this.watching){var s=o.maxScrollPos+t+-1;this.scroll.scroller.scrollBehaviorY.setMovingDirection(-1),this.scroll.scrollTo(this.scroll.x,s,this.scroll.options.bounceTime)}},t.pluginName="pullUpLoad",t}();o.a=i},445:function(t,o,s){"use strict";var e,l,i=s(435),n=[{key:"finishPullDown",name:"finishPullDown"},{key:"openPullDown",name:"openPullDown"},{key:"closePullDown",name:"closePullDown"},{key:"autoPullDownRefresh",name:"autoPullDownRefresh"}].map((function(t){return{key:t.key,sourceKey:"plugins.pullDownRefresh."+t.name}}));!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.MOVING=1]="MOVING",t[t.FETCHING=2]="FETCHING"}(e||(e={})),function(t){t[t.DEFAULT=0]="DEFAULT",t[t.INSIDE=1]="INSIDE",t[t.OUTSIDE=2]="OUTSIDE"}(l||(l={}));var r=function(){function t(t){this.scroll=t,this.pulling=e.DEFAULT,this.thresholdBoundary=l.DEFAULT,this.init()}return t.prototype.setPulling=function(t){this.pulling=t},t.prototype.setThresholdBoundary=function(t){this.thresholdBoundary=t},t.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullDownRefresh),this.handleHooks(),this.watch()},t.prototype.handleBScroll=function(){this.scroll.registerType(["pullingDown","enterThreshold","leaveThreshold"]),this.scroll.proxy(n)},t.prototype.handleOptions=function(t){void 0===t&&(t={}),t=!0===t?{}:t;this.options=Object(i.t)({threshold:90,stop:40},t),this.scroll.options.probeType=i.j.Realtime},t.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var o=this.scroll.scroller,s=o.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY=s.minScrollPos,this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,(function(){t.finishPullDown()})),this.registerHooks(s.hooks,s.hooks.eventTypes.computeBoundary,(function(o){o.maxScrollPos>0&&(o.maxScrollPos=-1),o.minScrollPos=t.currentMinScrollY})),this.hasMouseWheelPlugin()&&(this.registerHooks(this.scroll,this.scroll.eventTypes.alterOptions,(function(t){t.discreteTime=300,t.easeTime=350})),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,(function(){o.hooks.trigger(o.hooks.eventTypes.end)})))},t.prototype.registerHooks=function(t,o,s){t.on(o,s,this),this.hooksFn.push([t,o,s])},t.prototype.hasMouseWheelPlugin=function(){return!!this.scroll.eventTypes.alterOptions},t.prototype.watch=function(){var t=this.scroll.scroller;this.watching=!0,this.registerHooks(t.hooks,t.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)},t.prototype.resetStateBeforeScrollStart=function(){this.isFetchingStatus()||(this.setPulling(e.MOVING),this.setThresholdBoundary(l.DEFAULT))},t.prototype.checkLocationOfThresholdBoundary=function(){if(this.pulling===e.MOVING){var t=this.scroll,o=this.thresholdBoundary!==l.INSIDE&&this.locateInsideThresholdBoundary(),s=this.thresholdBoundary!==l.OUTSIDE&&!this.locateInsideThresholdBoundary();o&&(this.setThresholdBoundary(l.INSIDE),t.trigger("enterThreshold")),s&&(this.setThresholdBoundary(l.OUTSIDE),t.trigger("leaveThreshold"))}},t.prototype.locateInsideThresholdBoundary=function(){return this.scroll.y<=this.options.threshold},t.prototype.unwatch=function(){var t=this.scroll,o=t.scroller;this.watching=!1,o.hooks.off(o.hooks.eventTypes.end,this.checkPullDown),t.off(t.eventTypes.scrollStart,this.resetStateBeforeScrollStart),t.off(t.eventTypes.scroll,this.checkLocationOfThresholdBoundary),this.hasMouseWheelPlugin()&&t.off(t.eventTypes.mousewheelStart,this.resetStateBeforeScrollStart)},t.prototype.checkPullDown=function(){var t=this.options,o=t.threshold,s=t.stop;return!(this.scroll.y<o)&&(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,i.r.bounce),this.isFetchingStatus())},t.prototype.isFetchingStatus=function(){return this.pulling===e.FETCHING},t.prototype.modifyBehaviorYBoundary=function(t){var o=this.scroll.scroller.scrollBehaviorY;this.cachedOriginanMinScrollY=o.minScrollPos,this.currentMinScrollY=t,o.computeBoundary()},t.prototype.finishPullDown=function(){if(this.isFetchingStatus()){var t=this.scroll.scroller.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY,t.computeBoundary(),this.setPulling(e.DEFAULT),this.scroll.resetPosition(this.scroll.options.bounceTime,i.r.bounce)}},t.prototype.openPullDown=function(t){void 0===t&&(t={}),this.handleOptions(t),this.watching||this.watch()},t.prototype.closePullDown=function(){this.unwatch()},t.prototype.autoPullDownRefresh=function(){var t=this.options,o=t.threshold,s=t.stop;!this.isFetchingStatus()&&this.watching&&(this.modifyBehaviorYBoundary(s),this.scroll.trigger(this.scroll.eventTypes.scrollStart),this.scroll.scrollTo(this.scroll.x,o),this.setPulling(e.FETCHING),this.scroll.trigger("pullingDown"),this.scroll.scrollTo(this.scroll.x,s,this.scroll.options.bounceTime,i.r.bounce))},t.pluginName="pullDownRefresh",t}();o.a=r},466:function(t,o,s){"use strict";var e=s(0),l=s(467);e({global:!0,forced:parseInt!==l},{parseInt:l})},467:function(t,o,s){"use strict";var e=s(3),l=s(1),i=s(2),n=s(16),r=s(255).trim,c=s(256),h=e.parseInt,a=e.Symbol,u=a&&a.iterator,p=/^[+-]?0x/i,d=i(p.exec),f=8!==h(c+"08")||22!==h(c+"0x16")||u&&!l((function(){h(Object(u))}));t.exports=f?function(t,o){var s=r(n(t));return h(s,o>>>0||(d(p,s)?16:10))}:h},484:function(t,o,s){"use strict";s.d(o,"a",(function(){return l}));s(59);var e=s(177);function l(t,o,s){return(o=Object(e.a)(o))in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}},509:function(t,o,s){},582:function(t,o,s){"use strict";s(509)},734:function(t,o,s){"use strict";s.r(o);var e=s(484),l=s(44),i=s(85),n=(s(252),s(11),s(466),s(436)),r=s(445),c=s(444),h=s(446);n.a.use(r.a),n.a.use(c.a),n.a.use(h.a);var a={data:function(){return{beforePullDown:!0,isPullingDown:!1,isPullingUp:!1,dataList:new Array(2),stopPullup:!1}},created:function(){this.bscroll=null},mounted:function(){this.initBscroll()},methods:{initBscroll:function(){this.bscroll=new n.a(this.$refs.bsWrapper,{scrollY:!0,bounceTime:700,momentum:!1,pullDownRefresh:{threshold:50,stop:56},pullUpLoad:{threshold:-50},slide:{threshold:5,disableSetHeight:!0,autoplay:!1,loop:!1}}),this.bscroll.on("pullingDown",this.pullingDownHandler),this.bscroll.on("pullingUp",this.pullingUpHandler),this.bscroll.on("scroll",this.scrollHandler)},scrollHandler:function(t){if(t.y>=0){var o=this.$refs.pulldown,s=getComputedStyle(o,null).height;o.style.transform="translateY(".concat(-parseInt(s)+t.y,"px) translateZ(0)")}var e=this.bscroll.maxScrollY;if(t.y-e<=-30&&this.isPullingUp&&(this.stopPullup=!0),t.y-e<=0&&!this.stopPullup){var l=this.$refs.pullup;getComputedStyle(l,null).height;l.style.transform="translateY(".concat(t.y-e,"px) translateZ(0)")}},pullingDownHandler:function(){var t=this;return Object(i.a)(Object(l.a)().mark((function o(){return Object(l.a)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t.beforePullDown=!1,t.isPullingDown=!0,t.bscroll.enabled=!1,o.next=5,t.requestData("refresh");case 5:t.isPullingDown=!1,t.$nextTick((function(){t.bscroll.finishPullDown(),t.beforePullDown=!0,t.bscroll.enabled=!0,t.bscroll.refresh()}));case 7:case"end":return o.stop()}}),o)})))()},pullingUpHandler:function(){var t=this;return Object(i.a)(Object(l.a)().mark((function o(){return Object(l.a)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t.isPullingUp=!0,t.bscroll.enabled=!1,o.next=4,t.requestData("load");case 4:t.$nextTick((function(){t.isPullingUp=!1,t.bscroll.finishPullUp(),t.bscroll.enabled=!0,t.bscroll.refresh(),t.resetPullupPos()}));case 5:case"end":return o.stop()}}),o)})))()},requestData:function(t){var o=this;return Object(i.a)(Object(l.a)().mark((function s(){var e;return Object(l.a)().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,o.ajaxGet();case 3:e=s.sent,o.dataList="load"===t?e.concat(o.dataList):e,s.next=10;break;case 7:s.prev=7,s.t0=s.catch(0),console.log(s.t0);case 10:case"end":return s.stop()}}),s,null,[[0,7]])})))()},ajaxGet:function(){return new Promise((function(t){setTimeout((function(){var o=new Array(2);t(o)}),1e3)}))},resetPullupPos:function(){var t=this.$refs.pullup;t.style.transform="translateY(0px) translateZ(0)",t.style.transition="transform 0.5s",this.stopPullup=!1}}},u=(s(582),s(41)),p=Object(u.a)(a,(function(){var t=this,o=t._self._c;return o("div",{staticClass:"pullup-down-slide-wrapper"},[o("div",{ref:"pulldown",staticClass:"pulldown-wrapper"},[o("div",{directives:[{name:"show",rawName:"v-show",value:t.beforePullDown,expression:"beforePullDown"}]},[o("span",[t._v("Pull Down and refresh")])]),t._v(" "),o("div",{directives:[{name:"show",rawName:"v-show",value:!t.beforePullDown,expression:"!beforePullDown"}]},[o("div",{directives:[{name:"show",rawName:"v-show",value:t.isPullingDown,expression:"isPullingDown"}]},[o("span",[t._v("Loading...")])]),t._v(" "),o("div",{directives:[{name:"show",rawName:"v-show",value:!t.isPullingDown,expression:"!isPullingDown"}]},[o("span",[t._v("Refresh success")])])])]),t._v(" "),o("div",{ref:"bsWrapper",staticClass:"pullup-pulldown-slide-bswrapper"},[o("div",{staticClass:"pullup-pulldown-slide-scroller"},t._l(t.dataList,(function(s,l){return o("div",{key:l,staticClass:"pullup-pulldown-slide-item",class:Object(e.a)({},"page"+l%4,!0)},[t._v(t._s("Page ".concat(l," ")))])})),0)]),t._v(" "),o("div",{ref:"pullup",staticClass:"pullup-wrapper"},[o("div",{directives:[{name:"show",rawName:"v-show",value:!t.isPullingUp,expression:"!isPullingUp"}]},[o("span",[t._v("Pull Up and load")])]),t._v(" "),o("div",{directives:[{name:"show",rawName:"v-show",value:t.isPullingUp,expression:"isPullingUp"}]},[o("span",[t._v("Loading...")])])])])}),[],!1,null,"4d65a00a",null);o.default=p.exports}}]);