1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([[51],{445:function(t,o,e){"use strict";var s,l,i=e(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"}(s||(s={})),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=s.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,e=o.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY=e.minScrollPos,this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,(function(){t.finishPullDown()})),this.registerHooks(e.hooks,e.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,e){t.on(o,e,this),this.hooksFn.push([t,o,e])},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(s.MOVING),this.setThresholdBoundary(l.DEFAULT))},t.prototype.checkLocationOfThresholdBoundary=function(){if(this.pulling===s.MOVING){var t=this.scroll,o=this.thresholdBoundary!==l.INSIDE&&this.locateInsideThresholdBoundary(),e=this.thresholdBoundary!==l.OUTSIDE&&!this.locateInsideThresholdBoundary();o&&(this.setThresholdBoundary(l.INSIDE),t.trigger("enterThreshold")),e&&(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,e=t.stop;return!(this.scroll.y<o)&&(this.pulling===s.MOVING&&(this.modifyBehaviorYBoundary(e),this.setPulling(s.FETCHING),this.scroll.trigger("pullingDown")),this.scroll.scrollTo(this.scroll.x,e,this.scroll.options.bounceTime,i.r.bounce),this.isFetchingStatus())},t.prototype.isFetchingStatus=function(){return this.pulling===s.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(s.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,e=t.stop;!this.isFetchingStatus()&&this.watching&&(this.modifyBehaviorYBoundary(e),this.scroll.trigger(this.scroll.eventTypes.scrollStart),this.scroll.scrollTo(this.scroll.x,o),this.setPulling(s.FETCHING),this.scroll.trigger("pullingDown"),this.scroll.scrollTo(this.scroll.x,e,this.scroll.options.bounceTime,i.r.bounce))},t.pluginName="pullDownRefresh",t}();o.a=r},541:function(t,o,e){},704:function(t,o,e){"use strict";e(541)},763:function(t,o,e){"use strict";e.r(o);var s=e(44),l=e(85),i=(e(252),e(112),e(11),e(436)),n=e(445);function r(){for(var t=30*c,o=[],e=30*(c+1);e>t;e--)o.push(e);return o}i.a.use(n.a);var h={moving:{enter:"enter",leave:"leave"},fetching:"fetching",succeed:"succeed"},c=0,a='<svg width="16" height="16" viewBox="0 0 512 512"><path fill="currentColor" d="M367.997 338.75l-95.998 95.997V17.503h-32v417.242l-95.996-95.995l-22.627 22.627L256 496l134.624-134.623l-22.627-22.627z"></path></svg>',u='<svg width="16" height="16" viewBox="0 0 512 512"><path fill="currentColor" d="M390.624 150.625L256 16L121.376 150.625l22.628 22.627l95.997-95.998v417.982h32V77.257l95.995 95.995l22.628-22.627z"></path></svg>',p={data:function(){return{tipText:"",isPullingDown:!1,dataList:r()}},mounted:function(){this.initBscroll()},methods:{initBscroll:function(){var t=this;this.bscroll=new i.a(this.$refs.bsWrapper,{scrollY:!0,bounceTime:800,useTransition:!1,pullDownRefresh:{threshold:70,stop:56}}),this.bscroll.on("pullingDown",this.pullingDownHandler),this.bscroll.on("scrollEnd",(function(t){console.log("scrollEnd")})),this.bscroll.on("enterThreshold",(function(){t.setTipText(h.moving.enter)})),this.bscroll.on("leaveThreshold",(function(){t.setTipText(h.moving.leave)}))},pullingDownHandler:function(){var t=this;return Object(l.a)(Object(s.a)().mark((function o(){return Object(s.a)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t.setTipText(h.fetching),c+=1,o.next=4,t.getData();case 4:t.setTipText(h.succeed),t.bscroll.finishPullDown(),setTimeout((function(){t.bscroll.refresh()}),850);case 7:case"end":return o.stop()}}),o)})))()},getData:function(){var t=this;return Object(l.a)(Object(s.a)().mark((function o(){var e;return Object(s.a)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.mockFetchData();case 2:e=o.sent,t.dataList=e.concat(t.dataList);case 4:case"end":return o.stop()}}),o)})))()},mockFetchData:function(){return new Promise((function(t){setTimeout((function(){var o=r();t(o)}),2e3)}))},setTipText:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.default,o={enter:"".concat(a," Pull down"),leave:"".concat(u," Release"),fetching:"Loading...",succeed:"Refresh succeed"};this.tipText=o[t]}}},d=(e(704),e(41)),f=Object(d.a)(p,(function(){var t=this,o=t._self._c;return o("div",{staticClass:"pulldown-sina"},[o("div",{ref:"bsWrapper",staticClass:"pulldown-bswrapper"},[o("div",{staticClass:"pulldown-scroller"},[o("div",{staticClass:"pulldown-wrapper"},[o("div",{domProps:{innerHTML:t._s(t.tipText)}})]),t._v(" "),o("ul",{staticClass:"pulldown-list"},t._l(t.dataList,(function(e){return o("li",{key:e,staticClass:"pulldown-list-item"},[t._v(t._s("I am item ".concat(e," ")))])})),0)])])])}),[],!1,null,"24339483",null);o.default=f.exports}}]);
|