42.3c26eaba.js 5.5 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[42],{439:function(e,t,i){"use strict";var s=i(435),o=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,i){e.on(t,i,this),this.hooksFn.push([e,t,i])},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,i=t.scrollBehaviorX,o=t.scrollBehaviorY;i.setMovingDirection(s.b.Default),o.setMovingDirection(s.b.Default),i.setDirection(s.b.Default),o.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,i=this.mouseWheelOpt,s=i.throttleTime,o=i.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,o),c=a.performDampingAlgorithm(Math.round(e.y)+l.x,o);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:h,y:c})){var d=this.getEaseTime();h===this.scroll.x&&c===this.scroll.y||this.scroll.scrollTo(h,c,d)}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,i=t.speed,o=0,l=0,r=t.invert?s.b.Negative:s.b.Positive;switch(!0){case"deltaX"in e:1===e.deltaMode?(o=-e.deltaX*i,l=-e.deltaY*i):(o=-e.deltaX,l=-e.deltaY);break;case"wheelDeltaX"in e:o=e.wheelDeltaX/120*i,l=e.wheelDeltaY/120*i;break;case"wheelDelta"in e:o=l=e.wheelDelta/120*i;break;case"detail"in e:o=l=-e.detail/3*i}return o*=r,l*=r,this.scroll.hasVerticalScroll||(Math.abs(l)>Math.abs(o)&&(o=l),l=0),this.scroll.hasHorizontalScroll||(o=0),{x:o,y:l,directionX:o>0?s.b.Negative:o<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,i=t.preventDefault,o=t.stopPropagation,l=t.preventDefaultException;i&&!Object(s.L)(e.target,l)&&Object(s.H)(e),o&&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],i=e[1],s=e[2];t.off(i,s)}))},e.pluginName="mouseWheel",e.applyOrder=s.a.Pre,e}();t.a=o},529:function(e,t,i){},688:function(e,t,i){"use strict";i(529)},753:function(e,t,i){"use strict";i.r(t);var s=i(436),o=i(446),l=i(439);s.a.use(l.a),s.a.use(o.a);var r={data:function(){return{currentPageIndex:0}},mounted:function(){this.init()},beforeDestroy:function(){this.slide.destroy()},methods:{init:function(){this.slide=new s.a(this.$refs.slide,{scrollX:!1,scrollY:!0,slide:{loop:!0,threshold:100},mouseWheel:!0,momentum:!1,bounce:!1,stopPropagation:!0}),this.slide.on("scrollEnd",this._onScrollEnd)},_onScrollEnd:function(){var e=this.slide.getCurrentPage().pageY;this.currentPageIndex=e}}},n=(i(688),i(41)),a=Object(n.a)(r,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"mouse-wheel-slide-vertical"},[t("div",{staticClass:"slide-container"},[t("div",{ref:"slide",staticClass:"slide-wrapper"},[e._m(0)]),e._v(" "),t("div",{staticClass:"dots-wrapper"},e._l(4,(function(i,s){return t("span",{key:s,staticClass:"dot",class:{active:e.currentPageIndex===s}})})),0)])])}),[function(){var e=this._self._c;return e("div",{staticClass:"slide-content"},[e("div",{staticClass:"slide-page page1"},[this._v("page 1")]),this._v(" "),e("div",{staticClass:"slide-page page2"},[this._v("page 2")]),this._v(" "),e("div",{staticClass:"slide-page page3"},[this._v("page 3")]),this._v(" "),e("div",{staticClass:"slide-page page4"},[this._v("page 4")])])}],!1,null,null,null);t.default=a.exports}}]);