From 5330cced2a9a9bf77cc78b59f43f948256adcb4f Mon Sep 17 00:00:00 2001 From: wangyi7099 Date: Mon, 21 May 2018 20:44:42 +0800 Subject: [PATCH] fix: incorrect bar position when there is a error of scrollHeight in browser --- dist/vuescroll.common.js | 31 ++++++++++++------- dist/vuescroll.common.min.js | 2 +- dist/vuescroll.esm.js | 31 ++++++++++++------- dist/vuescroll.esm.min.js | 2 +- dist/vuescroll.js | 31 ++++++++++++------- dist/vuescroll.min.js | 2 +- .../child-components/vuescroll-content.js | 6 +++- src/mixins/api.js | 14 ++++----- src/mixins/mode/native-mode.js | 9 +++--- src/util/index.js | 12 +++---- test/unit/specs/api.spec.js | 5 +-- 11 files changed, 86 insertions(+), 59 deletions(-) diff --git a/dist/vuescroll.common.js b/dist/vuescroll.common.js index 2cabef31..3522eccd 100644 --- a/dist/vuescroll.common.js +++ b/dist/vuescroll.common.js @@ -128,14 +128,14 @@ function eventCenter(dom, eventName, hander) { var log = console; var error = void 0; -// It only happens when child is inline-block, +// It only happens when child is inline-block in chrome, // scollheight will have a error of -// 4px in chrome or some other browsers. -// So write a method to get the error and get the real scrollHeight. -function getRealScrollHeight(scrollHeight) { +// 4px, so write a method to compute the error. +// https://stackoverflow.com/questions/29132892/how-to-auto-resize-an-input-field-vertically-and-not-horizontally-like-facebook/29133328#29133328 +function getScrollError() { /* istanbul ignore next */ if (Vue.prototype.$isServer) return 0; - if (error !== undefined) return scrollHeight - error; + if (error !== undefined) return error; var outer = document.createElement('div'); outer.style.visibility = 'hidden'; outer.style.height = '100px'; @@ -150,7 +150,7 @@ function getRealScrollHeight(scrollHeight) { outer.appendChild(inner); error = outer.scrollHeight - outer.clientHeight; outer.parentNode.removeChild(outer); - return scrollHeight - error; + return error; } function isChildInParent(child, parent) { @@ -675,7 +675,8 @@ function goScrolling(elm, deltaX, deltaY, speed, easing, scrollingComplete) { if (startLocationY + deltaY < 0) { deltaY = -startLocationY; } - var scrollHeight = getRealScrollHeight(elm['scrollHeight']); + var error = getScrollError(); + var scrollHeight = elm['scrollHeight'] - error; if (startLocationY + deltaY > scrollHeight) { deltaY = scrollHeight - startLocationY; } @@ -711,6 +712,7 @@ var api = { var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var error = getScrollError(); if (typeof x === 'undefined') { x = this.vuescroll.state.internalScrollLeft || 0; } else { @@ -719,7 +721,7 @@ var api = { if (typeof y === 'undefined') { y = this.vuescroll.state.internalScrollTop || 0; } else { - y = getNumericValue(y, getRealScrollHeight(this.scrollPanelElm.scrollHeight)); + y = getNumericValue(y, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(x, y, animate, force); }, @@ -729,6 +731,8 @@ var api = { _ref2$dy = _ref2.dy, dy = _ref2$dy === undefined ? 0 : _ref2$dy; var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var error = getScrollError(); var _vuescroll$state = this.vuescroll.state, _vuescroll$state$inte = _vuescroll$state.internalScrollLeft, internalScrollLeft = _vuescroll$state$inte === undefined ? 0 : _vuescroll$state$inte, @@ -739,7 +743,7 @@ var api = { internalScrollLeft += getNumericValue(dx, this.scrollPanelElm.scrollWidth); } if (dy) { - internalScrollTop += getNumericValue(dy, getRealScrollHeight(this.scrollPanelElm.scrollHeight)); + internalScrollTop += getNumericValue(dy, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(internalScrollLeft, internalScrollTop, animate); }, @@ -871,11 +875,12 @@ var api = { var nativeMode = { methods: { updateNativeModeBarState: function updateNativeModeBarState() { + var error = getScrollError(); var scrollPanel = this.scrollPanelElm; var vuescroll = this.$el; - var heightPercentage = vuescroll.clientHeight * 100 / getRealScrollHeight(scrollPanel.scrollHeight); + var heightPercentage = vuescroll.clientHeight * 100 / (scrollPanel.scrollHeight - error); var widthPercentage = vuescroll.clientWidth * 100 / scrollPanel.scrollWidth; - this.bar.vBar.state.posValue = scrollPanel.scrollTop * 100 / vuescroll.clientHeight; + this.bar.vBar.state.posValue = (scrollPanel.scrollTop - error) * 100 / vuescroll.clientHeight; this.bar.hBar.state.posValue = scrollPanel.scrollLeft * 100 / vuescroll.clientWidth; this.bar.vBar.state.size = heightPercentage < 100 ? heightPercentage + '%' : 0; this.bar.hBar.state.size = widthPercentage < 100 ? widthPercentage + '%' : 0; @@ -2848,6 +2853,7 @@ var scrollContent = { slots = _ref.slots; var style = deepMerge(props.state.style, {}); + var error = getScrollError(); style.position = 'relative'; style.minHeight = '100%'; style.minWidth = '100%'; @@ -2856,6 +2862,9 @@ var scrollContent = { if (props.ops.padding) { style[props.ops.paddPos] = props.ops.paddValue; } + if (error) { + style.marginBottom = '-' + error + 'px'; + } return h(props.ops.tag, { style: style, ref: 'scrollContent', diff --git a/dist/vuescroll.common.min.js b/dist/vuescroll.common.min.js index 2dfb133d..064bbafb 100644 --- a/dist/vuescroll.common.min.js +++ b/dist/vuescroll.common.min.js @@ -5,4 +5,4 @@ * @license: MIT * @GitHub: https://github.com/wangyi7099/vuescroll */ -"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var Vue=_interopDefault(require("vue")),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function deepCopy(e,t){for(var i in t="object"===(void 0===t?"undefined":_typeof(t))&&t||{},e)t[i]="object"===_typeof(e[i])?deepCopy(e[i],t[i]={}):e[i];return t}function deepMerge(e,t){for(var i in t=t||{},e)"object"===_typeof(e[i])?void 0===t[i]?(t[i]={},deepCopy(e[i],t[i])):deepMerge(e[i],t[i]):void 0===t[i]&&(t[i]=e[i]);return t}function defineReactive(e,t,i,o){var r=null;(i[t]||"function"==typeof i)&&(o=o||t,"function"==typeof i&&(r=i),Object.defineProperty(e,t,{get:r||function(){return i[o]},configurable:!0}))}var scrollBarWidth=void 0;function getGutter(){if(Vue.prototype.$isServer)return 0;if(void 0!==scrollBarWidth)return scrollBarWidth;var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var i=document.createElement("div");i.style.width="100%",e.appendChild(i);var o=i.offsetWidth;return e.parentNode.removeChild(e),scrollBarWidth=t-o}var doneUtil={refreshDomStyle:!1,loadDomStyle:!1,hide:!1};function hideSystemBar(){if(!doneUtil.hide){doneUtil.hide=!0;var e=document.createElement("style");e.type="text/css",e.innerHTML=".vuescroll-panel::-webkit-scrollbar{width:0;height:0}",document.getElementsByTagName("HEAD").item(0).appendChild(e)}}var styleMap={};function createDomStyle(e){if(!doneUtil[e]){doneUtil[e]=!0;var t=document.createElement("style");t.type="text/css",t.innerHTML=styleMap[e],document.getElementsByTagName("HEAD").item(0).appendChild(t)}}function eventCenter(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"on"==(arguments.length>4&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,i,o):e.removeEventListener(t,i,o)}styleMap.refreshDomStyle="\n.vuescroll-refresh {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-refresh svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-refresh svg path,\n.vuescroll-refresh svg rect{\nfill: #FF6700;\n}\n",styleMap.loadDomStyle="\n.vuescroll-load {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-load svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-load svg path,\n.vuescroll-load svg rect{\nfill: #FF6700;\n}\n";var log=console,error=void 0;function getRealScrollHeight(e){if(Vue.prototype.$isServer)return 0;if(void 0!==error)return e-error;var t=document.createElement("div");t.style.visibility="hidden",t.style.height="100px",t.style.position="absolute",t.style.top="-9999px",t.style.overflow="hidden",document.body.appendChild(t);var i=document.createElement("div");return i.style.visibility="hidden",i.style.height="100px",i.style.display="inline-block",t.appendChild(i),error=t.scrollHeight-t.clientHeight,t.parentNode.removeChild(t),e-error}function isChildInParent(e,t){var i=!1;if(!e||!t)return i;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(i=!0),i}function listenResize(e,t){var i=document.createElement("object");return i.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i.tabIndex=-1,i.type="text/html",i.data="about:blank",i.isResizeElm=!0,i.onload=function(){eventCenter(i.contentDocument.defaultView,"resize",t)},e.appendChild(i),function(){i.contentDocument&&eventCenter(i.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i)}}var modes=["slide","native","pure-native"],NOOP=function(){},smallChangeArray=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],GCF={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{tag:"div",padding:!1,props:{},attrs:{}},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{vBar:{background:"#00a650",deltaY:100,keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};function validateOptions(e){var t=!1,i=e.vuescroll,o=e.scrollPanel;~modes.indexOf(i.mode)||(log.error('[vuescroll]: The vuescroll\'s option "mode" should be one of the '+modes),t=!0),i.paging==i.snapping.enable&&i.paging&&(i.pullRefresh||i.pushLoad)&&log.error("[vuescroll]: paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var r=o.initialScrollY,l=o.initialScrollX;return r&&!String(r).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}function hackPropsData(){var e=this;if("vueScroll"===e.$options.name){var t=deepMerge(e.$vuescrollConfig,{}),i=deepMerge(GCF,t);e.$options.propsData.ops=e.$options.propsData.ops||{},Object.keys(e.$options.propsData.ops).forEach(function(t){defineReactive(e.mergedOptions,t,e.$options.propsData.ops)}),deepMerge(i,e.mergedOptions),defineReactive(e.mergedOptions.bar.vBar,"pos",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.vBar,"width",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.hBar,"pos",e.mergedOptions.rail.hRail),defineReactive(e.mergedOptions.bar.hBar,"height",e.mergedOptions.rail.hRail);defineReactive(e.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+e.mergedOptions.rail.vRail.pos}),defineReactive(e.mergedOptions.scrollContent,"paddValue",function(){return e.mergedOptions.rail.vRail.width})}}var hackLifecycle={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){hackPropsData.call(this),this.renderError=validateOptions(this.mergedOptions)}};function createEasingFunction(e,t){return function(i){return t(e,i)}}function easingPattern(e,t){var i=null;return"easeInQuad"===e&&(i=t*t),"easeOutQuad"===e&&(i=t*(2-t)),"easeInOutQuad"===e&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(i=t*t*t),"easeOutCubic"===e&&(i=--t*t*t+1),"easeInOutCubic"===e&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(i=t*t*t*t),"easeOutQuart"===e&&(i=1- --t*t*t*t),"easeInOutQuart"===e&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(i=t*t*t*t*t),"easeOutQuint"===e&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),i||t}function requestAnimationFrame(e){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,i=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(i=!1),i)return function(e,i){t(e,i)};var o={},r=1,l=null,s=+new Date;return function(e){var t=r++;return o[t]=e,requestCount++,null===l&&(l=setInterval(function(){var e=+new Date,t=o;for(var i in o={},requestCount=0,t)t.hasOwnProperty(i)&&(t[i](e),s=e);e-s>2500&&(clearInterval(l),l=null)},1e3/60)),t}}var time=Date.now||function(){return+new Date},desiredFrames=60,millisecondsPerSecond=1e3,running={},counter=1,core={effect:{}},global=null;function getNumericValue(e,t){var i=void 0;return i=(i=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(i=i[1]-0)/100:e-0}function goScrolling(e,t,i,o,r,l){var s=e.scrollTop,n=e.scrollLeft,a=n,c=s;s+i<0&&(i=-s);var h=getRealScrollHeight(e.scrollHeight);s+i>h&&(i=h-s),n+t<0&&(t=-n),n+t>e.scrollWidth&&(t=e.scrollWidth-n);var _=createEasingFunction(r,easingPattern);core.effect.Animate.start(function(o){a=n+t*o,c=s+i*o,e.scrollTop=Math.floor(c),e.scrollLeft=Math.floor(a)},function(){return Math.abs(c-s)<=Math.abs(i)||Math.abs(a-n)<=Math.abs(t)},l,o,_)}global="undefined"!=typeof window?window:{},core.effect.Animate={requestAnimationFrame:requestAnimationFrame(global),stop:function(e){var t=null!=running[e];return t&&(running[e]=null),t},isRunning:function(e){return null!=running[e]},start:function(e,t,i,o,r,l){var s=time(),n=s,a=0,c=0,h=counter++;if(l||(l=document.body),h%20==0){var _={};for(var d in running)_[d]=!0;running=_}return running[h]=!0,core.effect.Animate.requestAnimationFrame(function _(d){var u=!0!==d,p=time();if(!running[h]||t&&!t(h))return running[h]=null,void(i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,!1));if(u)for(var f=Math.round((p-n)/(millisecondsPerSecond/desiredFrames))-1,m=0;m1&&(a=1);var v=r?r(a):a;!1!==e(v,p,u)&&1!==a||!u?u&&(n=p,core.effect.Animate.requestAnimationFrame(_,l)):(running[h]=null,i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,1===a||null==o))},l),h}};var api={methods:{scrollTo:function(e){var t=e.x,i=e.y,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=void 0===t?this.vuescroll.state.internalScrollLeft||0:getNumericValue(t,this.scrollPanelElm.scrollWidth),i=void 0===i?this.vuescroll.state.internalScrollTop||0:getNumericValue(i,getRealScrollHeight(this.scrollPanelElm.scrollHeight)),this.internalScrollTo(t,i,o,r)},scrollBy:function(e){var t=e.dx,i=void 0===t?0:t,o=e.dy,r=void 0===o?0:o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=this.vuescroll.state,n=s.internalScrollLeft,a=void 0===n?0:n,c=s.internalScrollTop,h=void 0===c?0:c;i&&(a+=getNumericValue(i,this.scrollPanelElm.scrollWidth)),r&&(h+=getNumericValue(r,getRealScrollHeight(this.scrollPanelElm.scrollHeight))),this.internalScrollTo(a,h,l)},zoomBy:function(e,t,i,o,r){"slide"==this.mode?this.scroller.zoomBy(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments[2],o=arguments[3],r=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},getCurrentviewDom:function(){for(var e=this,t=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,i=[],o=function(t){var i=t.getBoundingClientRect(),o=i.left,r=i.top,l=i.width,s=i.height,n=e.$el.getBoundingClientRect(),a=n.left,c=n.top,h=n.height,_=n.width;return o-a+l>0&&o-a<_&&r-c+s>0&&r-c1&&void 0!==arguments[1])||arguments[1],i=this.$el;if("string"==typeof e&&(e=i.querySelector(e)),isChildInParent(e,i)){var o=this.$el.getBoundingClientRect(),r=o.left,l=o.top,s=e.getBoundingClientRect(),n=r-s.left,a=l-s.top;this.scrollBy({dx:-n,dy:-a},t)}else log.warn("[vuescroll]: The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")}}},nativeMode={methods:{updateNativeModeBarState:function(){var e=this.scrollPanelElm,t=this.$el,i=100*t.clientHeight/getRealScrollHeight(e.scrollHeight),o=100*t.clientWidth/e.scrollWidth;this.bar.vBar.state.posValue=100*e.scrollTop/t.clientHeight,this.bar.hBar.state.posValue=100*e.scrollLeft/t.clientWidth,this.bar.vBar.state.size=i<100?i+"%":0,this.bar.hBar.state.size=o<100?o+"%":0}}},animatingMethod=null,noAnimatingMethod=null;function Scroller(e,t){for(var i in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:NOOP,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[i]=t[i];animatingMethod=createEasingFunction(this.options.animatingEasing,easingPattern),noAnimatingMethod=createEasingFunction(this.options.noAnimatingEasing,easingPattern)}var members={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,i,o){e===+e&&(this.__clientWidth=e),t===+t&&(this.__clientHeight=t),i===+i&&(this.__contentWidth=i),o===+o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__refreshHeight=e,this.__refreshActivate=i,this.__refreshBeforeDeactivate=l,this.__refreshDeactivate=o,this.__refreshStart=r},activatePushToLoad:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__loadHeight=e,this.__loadActivate=i,this.__loadBeforeDeactivate=l,this.__loadDeactivate=o,this.__loadStart=r},triggerRefreshOrLoad:function(){"refresh"==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"refresh")?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart())},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,i,o,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1);var l=this.__zoomLevel;null==i&&(i=this.__clientWidth/2),null==o&&(o=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);var s=(i+this.__scrollLeft)*e/l-i,n=(o+this.__scrollTop)*e/l-o;s>this.__maxScrollLeft?s=this.__maxScrollLeft:s<0&&(s=0),n>this.__maxScrollTop?n=this.__maxScrollTop:n<0&&(n=0),this.__publish(s,n,e,t)},zoomBy:function(e,t,i,o,r){this.zoomTo(this.__zoomLevel*e,t,i,o,r)},scrollTo:function(e,t,i,o,r){if(this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1),null!=o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=o,t*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX||r?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY||r?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(i=!1),this.__isTracking||this.__publish(e,t,o,i)},scrollBy:function(e,t,i){var o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(e||0),r+(t||0),i)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var i=e.x,o=e.y;isNaN(i)&&(i=1),isNaN(o)&&(o=1),this.scrollTo((i-1)*this.__clientWidth,(o-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,i,o){var r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,i-this.__clientLeft,o-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1,this.__interruptedAnimation=!0),this.__isAnimating&&(core.effect.Animate.stop(this.__isAnimating),this.__isAnimating=!1,this.__interruptedAnimation=!0);var r=1===e.length;r?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=i,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=i,this.__lastTouchTop=o,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]},doTouchMove:function(e,t,i){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){var o,r;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,r=e[0].pageY);var l=this.__positions;if(this.__isDragging){var s=o-this.__lastTouchLeft,n=r-this.__lastTouchTop,a=this.__scrollLeft,c=this.__scrollTop,h=this.__zoomLevel;if(null!=i&&this.options.zooming){var _=h;if(h=h/this.__lastScale*i,_!==(h=Math.max(Math.min(h,this.options.maxZoom),this.options.minZoom))){var d=o-this.__clientLeft,u=r-this.__clientTop;a=(d+a)*h/_-d,c=(u+c)*h/_-u,this.__computeScrollMax(h)}}if(this.__enableScrollX){a-=s*this.options.speedMultiplier;var p=this.__maxScrollLeft;(a>p||a<0)&&(this.options.bouncing?a+=s/2*this.options.speedMultiplier:a=a>p?p:0)}if(this.__enableScrollY){c-=n*this.options.speedMultiplier;var f=this.__maxScrollTop;(c>f||c<0)&&(this.options.bouncing?(c+=n/2*this.options.speedMultiplier,this.__enableScrollX||null==this.__refreshHeight&&null==this.__loadHeight||(!this.__refreshActive&&c<=-this.__refreshHeight?(this.__refreshActive=!0,this.__refreshActivate&&this.__refreshActivate()):this.__refreshActive&&c>-this.__refreshHeight?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):!this.__loadActive&&c>=this.__maxScrollTop+this.__loadHeight?(this.__loadActive=!0,this.__loadActivate&&this.__loadActivate()):this.__refreshActive&&cf?f:0)}l.length>60&&l.splice(0,30),l.push(a,c,t),this.__publish(a,c,h)}else{var m=this.options.locking?3:0,v=Math.abs(o-this.__initialTouchLeft),g=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&v>=m,this.__enableScrollY=this.options.scrollingY&&g>=m,l.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(v>=5||g>=5),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=i}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){for(var t=this.__positions,i=t.length-1,o=i,r=i;r>0&&t[r]>this.__lastTouchMove-100;r-=3)o=r;if(o!==i){var l=t[i]-t[o],s=this.__scrollLeft-t[o-2],n=this.__scrollTop-t[o-1];this.__decelerationVelocityX=s/l*(1e3/60),this.__decelerationVelocityY=n/l*(1e3/60);var a=this.options.paging||this.options.snapping?4:1;Math.abs(this.__decelerationVelocityX)>a||Math.abs(this.__decelerationVelocityY)>a?this.__refreshActive||this.__loadActive||this.__startDeceleration(e):this.__scrollComplete()}else this.__scrollComplete()}else e-this.__lastTouchMove>100&&this.__scrollComplete();this.__isDecelerating||(this.__refreshActive&&this.__refreshStart?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):this.__loadActive&&this.__loadStart?(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart()):((this.__interruptedAnimation||this.__isDragging)&&this.__scrollComplete(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel),this.__refreshActive?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):this.__loadActive&&(this.__loadActive=!1,this.__loadDeactivate&&this.__loadDeactivate()))),this.__positions.length=0}},onScroll:NOOP,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,i,o){var r=this;if(!r.__disable){!isNaN(e)&&e||(e=this.__scrollLeft),!isNaN(t)&&t||(t=this.__scrollTop);var l=r.__isAnimating;if(l&&(core.effect.Animate.stop(l),r.__isAnimating=!1),o&&r.options.animating){r.__scheduledLeft=e,r.__scheduledTop=t,r.__scheduledZoom=i;var s=r.__scrollLeft,n=r.__scrollTop,a=r.__zoomLevel,c=e-s,h=t-n,_=i-a;r.__isAnimating=core.effect.Animate.start(function(e,t,i){i&&(r.__scrollLeft=s+c*e,r.__scrollTop=n+h*e,r.__zoomLevel=a+_*e,r.__callback&&(r.__callback(r.__scrollLeft,r.__scrollTop,r.__zoomLevel),r.onScroll()))},function(e){return r.__isAnimating===e},function(e,t,i){t===r.__isAnimating&&(r.__isAnimating=!1),(r.__didDecelerationComplete||i)&&r.__scrollComplete(),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))},r.options.animationDuration,l?animatingMethod:noAnimatingMethod)}else r.__scheduledLeft=r.__scrollLeft=e,r.__scheduledTop=r.__scrollTop=t,r.__scheduledZoom=r.__zoomLevel=i,r.__callback&&(r.__callback(e,t,i),r.onScroll()),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))}},__computeScrollMax:function(e){null==e&&(e=this.__zoomLevel),this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)},__computePage:function(){var e=this.__clientWidth,t=this.__clientHeight,i=this.__scrollLeft,o=this.__scrollTop;this.__totalXPage=Math.ceil(this.__contentWidth/e),this.__currentPageX=Math.ceil(i/e+1),this.__totalYPage=Math.ceil(this.__contentHeight/t),this.__currentPageY=Math.ceil(o/t+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),i=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),o=e.__clientWidth,r=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/o)*o,e.__minDecelerationScrollTop=Math.floor(i/r)*r,e.__maxDecelerationScrollLeft=Math.ceil(t/o)*o,e.__maxDecelerationScrollTop=Math.ceil(i/r)*r}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop;var l=e.options.snapping?4:.001;e.__isDecelerating=core.effect.Animate.start(function(t,i,o){e.__stepThroughDeceleration(o)},function(){var t=Math.abs(e.__decelerationVelocityX)>=l||Math.abs(e.__decelerationVelocityY)>=l;return t||(e.__didDecelerationComplete=!0),t},function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollComplete(),e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)})},__stepThroughDeceleration:function(e){var t=this.__scrollLeft+this.__decelerationVelocityX,i=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){var o=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);o!==t&&(t=o,this.__decelerationVelocityX=0);var r=Math.max(Math.min(this.__maxDecelerationScrollTop,i),this.__minDecelerationScrollTop);r!==i&&(i=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,i,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=i),!this.options.paging){this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95}if(this.options.bouncing){var l=0,s=0,n=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;tthis.__maxDecelerationScrollLeft&&(l=this.__maxDecelerationScrollLeft-t),ithis.__maxDecelerationScrollTop&&(s=this.__maxDecelerationScrollTop-i),0!==l&&(l*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=l*n:this.__decelerationVelocityX=l*a),0!==s&&(s*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=s*n:this.__decelerationVelocityY=s*a)}}};for(var key in members)Scroller.prototype[key]=members[key];function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function render(e,t,i,o){var r,l=document.documentElement.style,s=null,n=null;t.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?r="presto":"MozAppearance"in l?r="gecko":"WebkitAppearance"in l?r="webkit":"string"==typeof navigator.cpuClass&&(r="trident"),"string"==typeof e&&(n="vertical"==e?(s=0)||o:(s=o)&&0);var a={trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[r],c=document.createElement("div"),h=a+"Perspective";return void 0!==c.style[h]?"string"==typeof e?_defineProperty({},"transform","translate3d("+s+i+","+n+i+",0)"):function(t,o,r){e.style.transform="translate3d("+-t+i+","+-o+i+",0) scale("+r+")"}:void 0!==c.style.transform?"string"==typeof e?_defineProperty({},"transform","translate("+s+i+","+n+i+")"):function(t,o,r){e.style.transform="translate("+-t+i+","+-o+i+") scale("+r+")"}:void 0}function listenContainer(e,t,i,o,r){var l=null;function s(e){e.touches[0]&&e.touches[0].target&&e.touches[0].target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart(e.touches,e.timeStamp),r&&e.preventDefault(),document.addEventListener("touchmove",n,{passive:!1}))}function n(e){i("mousemove"),t.doTouchMove(e.touches,e.timeStamp,e.scale),e.preventDefault()}function a(e){i("mouseup"),t.doTouchEnd(e.timeStamp),document.removeEventListener("touchmove",n)}function c(e){t.doTouchEnd(e.timeStamp)}function h(e){e.target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),r&&e.preventDefault(),p=!0)}function _(e){p&&(i("mousemove"),t.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),p=!0)}function d(e){p&&(i("mouseup"),t.doTouchEnd(e.timeStamp),p=!1)}function u(e){t.doMouseZoom(e.detail?-120*e.detail:e.wheelDelta,e.timeStamp,e.pageX,e.pageY)}if("ontouchstart"in window)e.addEventListener("touchstart",s,!1),document.addEventListener("touchend",a,!1),document.addEventListener("touchcancel",c,!1),l=function(){e.removeEventListener("touchstart",s,!1),document.removeEventListener("touchend",a,!1),document.removeEventListener("touchcancel",c,!1)};else{var p=!1;e.addEventListener("mousedown",h,!1),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",d,!1),o&&e.addEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1),l=function(){e.removeEventListener("mousedown",h,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",d,!1),e.removeEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1)}}return t.onScroll=function(){i("onscroll")},l}var _extends=Object.assign||function(e){for(var t=1;to.__maxScrollLeft&&(r=o.__scrollLeft-o.__maxScrollLeft)),_&&(o.__scrollTop<0?l=-o.__scrollTop:o.__scrollTop>o.__maxScrollTop&&(l=o.__scrollTop-o.__maxScrollTop)),e=100*n/(c+l),t=100*s/(a+r);var d=Math.min(Math.max(0,o.__scrollTop),o.__maxScrollTop),u=Math.min(Math.max(0,o.__scrollLeft),o.__maxScrollLeft);this.bar.vBar.state.posValue=100*(d+l)/i.clientHeight,this.bar.hBar.state.posValue=100*(u+r)/i.clientWidth,o.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),o.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t="refresh"==e?"refreshDom":"loadDom",i="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,o="refresh"==e?"refreshStage":"loadStage",r=this.$refs[t].elm||this.$refs[t],l=createStateCallbacks(e,o,this,r),s=r.offsetHeight;i.bind(this.scroller)(s,l)}}},map={vertical:{bar:{size:"height",opsSize:"width",posName:"top",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY"},axis:"Y"},horizontal:{bar:{size:"width",opsSize:"height",posName:"left",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX"},axis:"X"}},_extends$1=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null;"native"==this.mode||"pure-native"==this.mode?this.updateNativeModeBarState():"slide"==this.mode&&this.updateSlideModeBarState(),e&&this.emitEvent(e,t)},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e),this.showAndDefferedHideBar()},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.vuescroll.state.timeoutId&&clearTimeout(this.vuescroll.state.timeoutId),this.vuescroll.state.timeoutId=setTimeout(function(){e.vuescroll.state.timeoutId=0,e.hideBar()},500)},emitEvent:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.scrollPanelElm,o=i.scrollHeight,r=i.scrollWidth,l=i.clientHeight,s=i.clientWidth,n=i.scrollTop,a=i.scrollLeft,c={type:"vertical"},h={type:"horizontal"};"slide"==this.mode&&(n=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,l=this.$el.clientHeight,s=this.$el.clientWidth),c.process=Math.min(n/(o-l),1),h.process=Math.min(a/(r-s),1),c.barSize=this.bar.vBar.state.size,h.barSize=this.bar.hBar.state.size,c.scrollTop=n,h.scrollLeft=a,this.$emit(e,c,h,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var e=this;this.destroyResize&&this.destroyResize();var t=null;"slide"==this.mode||"pure-native"==this.mode?t=this.scrollPanelElm:"native"==this.mode&&(t=this.scrollContentElm);var i=function(){e.updateBarStateAndEmitEvent(),e.showAndDefferedHideBar(),"slide"==e.mode&&e.updateScroller()};window.addEventListener("resize",i,!1);var o=listenResize(t,function(){var t={};"slide"==e.mode?(e.updateScroller(),t.width=e.scroller.__contentWidth,t.height=e.scroller.__contentHeight):"native"!=e.mode&&"pure-native"!=e.mode||(t.width=e.scrollPanelElm.scrollWidth,t.height=e.scrollPanelElm.scrollHeight),e.updateBarStateAndEmitEvent("handle-resize",t),e.showAndDefferedHideBar()});this.destroyResize=function(){window.removeEventListener("resize",i,!1),o()}},registryParentResize:function(){this.destroyParentDomResize=listenResize(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.clientHeight+"px",this.vuescroll.state.width=e.clientWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=findValuesByMode(e,this);this.vuescroll.state.internalScrollLeft=t.x,this.vuescroll.state.internalScrollTop=t.y},initWatch:function(){var e=this,t={deep:!0,sync:!0};this.$watch("mergedOptions",function(){e.recordCurrentPos(),e.$nextTick(function(){1!=e.isSmallChangeThisTick?(e.registryResize(),e.updateMode(),e.setVsSize()):e.isSmallChangeThisTick=!1})},t),smallChangeArray.forEach(function(i){e.$watch(i,function(){e.isSmallChangeThisTick=!0},t)})},scrollToHash:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||function(e){return/^#[a-zA-Z_]\d*$/.test(e)}(e))){var t=document.querySelector(e);!isChildInParent(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}}},mounted:function(){this.renderError||("slide"==this.mode&&(this.destroyScroller=this.registryScroller()),this.$el._isVuescroll=!0,this.lastMode=this.mode,this.registryResize(),this.initWatch(),this.setVsSize(),this.updateBarStateAndEmitEvent(),this.showAndDefferedHideBar(),this.scrollToHash())},updated:function(){var e=this;this.$nextTick(function(){e._isDestroyed||e.showAndDefferedHideBar()})},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)}},Vuescroll={install:function(e){e.component(vueScrollCore.name,vueScrollCore),e.prototype.$vuescrollConfig=deepMerge(GCF,{})},version:"4.5.18"};"undefined"!=typeof window&&window.Vue&&Vue.use(Vuescroll),module.exports=Vuescroll; \ No newline at end of file +"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var Vue=_interopDefault(require("vue")),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function deepCopy(e,t){for(var i in t="object"===(void 0===t?"undefined":_typeof(t))&&t||{},e)t[i]="object"===_typeof(e[i])?deepCopy(e[i],t[i]={}):e[i];return t}function deepMerge(e,t){for(var i in t=t||{},e)"object"===_typeof(e[i])?void 0===t[i]?(t[i]={},deepCopy(e[i],t[i])):deepMerge(e[i],t[i]):void 0===t[i]&&(t[i]=e[i]);return t}function defineReactive(e,t,i,o){var r=null;(i[t]||"function"==typeof i)&&(o=o||t,"function"==typeof i&&(r=i),Object.defineProperty(e,t,{get:r||function(){return i[o]},configurable:!0}))}var scrollBarWidth=void 0;function getGutter(){if(Vue.prototype.$isServer)return 0;if(void 0!==scrollBarWidth)return scrollBarWidth;var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var i=document.createElement("div");i.style.width="100%",e.appendChild(i);var o=i.offsetWidth;return e.parentNode.removeChild(e),scrollBarWidth=t-o}var doneUtil={refreshDomStyle:!1,loadDomStyle:!1,hide:!1};function hideSystemBar(){if(!doneUtil.hide){doneUtil.hide=!0;var e=document.createElement("style");e.type="text/css",e.innerHTML=".vuescroll-panel::-webkit-scrollbar{width:0;height:0}",document.getElementsByTagName("HEAD").item(0).appendChild(e)}}var styleMap={};function createDomStyle(e){if(!doneUtil[e]){doneUtil[e]=!0;var t=document.createElement("style");t.type="text/css",t.innerHTML=styleMap[e],document.getElementsByTagName("HEAD").item(0).appendChild(t)}}function eventCenter(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"on"==(arguments.length>4&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,i,o):e.removeEventListener(t,i,o)}styleMap.refreshDomStyle="\n.vuescroll-refresh {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-refresh svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-refresh svg path,\n.vuescroll-refresh svg rect{\nfill: #FF6700;\n}\n",styleMap.loadDomStyle="\n.vuescroll-load {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-load svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-load svg path,\n.vuescroll-load svg rect{\nfill: #FF6700;\n}\n";var log=console,error=void 0;function getScrollError(){if(Vue.prototype.$isServer)return 0;if(void 0!==error)return error;var e=document.createElement("div");e.style.visibility="hidden",e.style.height="100px",e.style.position="absolute",e.style.top="-9999px",e.style.overflow="hidden",document.body.appendChild(e);var t=document.createElement("div");return t.style.visibility="hidden",t.style.height="100px",t.style.display="inline-block",e.appendChild(t),error=e.scrollHeight-e.clientHeight,e.parentNode.removeChild(e),error}function isChildInParent(e,t){var i=!1;if(!e||!t)return i;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(i=!0),i}function listenResize(e,t){var i=document.createElement("object");return i.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i.tabIndex=-1,i.type="text/html",i.data="about:blank",i.isResizeElm=!0,i.onload=function(){eventCenter(i.contentDocument.defaultView,"resize",t)},e.appendChild(i),function(){i.contentDocument&&eventCenter(i.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i)}}var modes=["slide","native","pure-native"],NOOP=function(){},smallChangeArray=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],GCF={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{tag:"div",padding:!1,props:{},attrs:{}},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{vBar:{background:"#00a650",deltaY:100,keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};function validateOptions(e){var t=!1,i=e.vuescroll,o=e.scrollPanel;~modes.indexOf(i.mode)||(log.error('[vuescroll]: The vuescroll\'s option "mode" should be one of the '+modes),t=!0),i.paging==i.snapping.enable&&i.paging&&(i.pullRefresh||i.pushLoad)&&log.error("[vuescroll]: paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var r=o.initialScrollY,l=o.initialScrollX;return r&&!String(r).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}function hackPropsData(){var e=this;if("vueScroll"===e.$options.name){var t=deepMerge(e.$vuescrollConfig,{}),i=deepMerge(GCF,t);e.$options.propsData.ops=e.$options.propsData.ops||{},Object.keys(e.$options.propsData.ops).forEach(function(t){defineReactive(e.mergedOptions,t,e.$options.propsData.ops)}),deepMerge(i,e.mergedOptions),defineReactive(e.mergedOptions.bar.vBar,"pos",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.vBar,"width",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.hBar,"pos",e.mergedOptions.rail.hRail),defineReactive(e.mergedOptions.bar.hBar,"height",e.mergedOptions.rail.hRail);defineReactive(e.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+e.mergedOptions.rail.vRail.pos}),defineReactive(e.mergedOptions.scrollContent,"paddValue",function(){return e.mergedOptions.rail.vRail.width})}}var hackLifecycle={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){hackPropsData.call(this),this.renderError=validateOptions(this.mergedOptions)}};function createEasingFunction(e,t){return function(i){return t(e,i)}}function easingPattern(e,t){var i=null;return"easeInQuad"===e&&(i=t*t),"easeOutQuad"===e&&(i=t*(2-t)),"easeInOutQuad"===e&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(i=t*t*t),"easeOutCubic"===e&&(i=--t*t*t+1),"easeInOutCubic"===e&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(i=t*t*t*t),"easeOutQuart"===e&&(i=1- --t*t*t*t),"easeInOutQuart"===e&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(i=t*t*t*t*t),"easeOutQuint"===e&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),i||t}function requestAnimationFrame(e){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,i=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(i=!1),i)return function(e,i){t(e,i)};var o={},r=1,l=null,s=+new Date;return function(e){var t=r++;return o[t]=e,requestCount++,null===l&&(l=setInterval(function(){var e=+new Date,t=o;for(var i in o={},requestCount=0,t)t.hasOwnProperty(i)&&(t[i](e),s=e);e-s>2500&&(clearInterval(l),l=null)},1e3/60)),t}}var time=Date.now||function(){return+new Date},desiredFrames=60,millisecondsPerSecond=1e3,running={},counter=1,core={effect:{}},global=null;function getNumericValue(e,t){var i=void 0;return i=(i=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(i=i[1]-0)/100:e-0}function goScrolling(e,t,i,o,r,l){var s=e.scrollTop,n=e.scrollLeft,a=n,c=s;s+i<0&&(i=-s);var h=getScrollError(),_=e.scrollHeight-h;s+i>_&&(i=_-s),n+t<0&&(t=-n),n+t>e.scrollWidth&&(t=e.scrollWidth-n);var d=createEasingFunction(r,easingPattern);core.effect.Animate.start(function(o){a=n+t*o,c=s+i*o,e.scrollTop=Math.floor(c),e.scrollLeft=Math.floor(a)},function(){return Math.abs(c-s)<=Math.abs(i)||Math.abs(a-n)<=Math.abs(t)},l,o,d)}global="undefined"!=typeof window?window:{},core.effect.Animate={requestAnimationFrame:requestAnimationFrame(global),stop:function(e){var t=null!=running[e];return t&&(running[e]=null),t},isRunning:function(e){return null!=running[e]},start:function(e,t,i,o,r,l){var s=time(),n=s,a=0,c=0,h=counter++;if(l||(l=document.body),h%20==0){var _={};for(var d in running)_[d]=!0;running=_}return running[h]=!0,core.effect.Animate.requestAnimationFrame(function _(d){var u=!0!==d,p=time();if(!running[h]||t&&!t(h))return running[h]=null,void(i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,!1));if(u)for(var f=Math.round((p-n)/(millisecondsPerSecond/desiredFrames))-1,m=0;m1&&(a=1);var v=r?r(a):a;!1!==e(v,p,u)&&1!==a||!u?u&&(n=p,core.effect.Animate.requestAnimationFrame(_,l)):(running[h]=null,i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,1===a||null==o))},l),h}};var api={methods:{scrollTo:function(e){var t=e.x,i=e.y,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=getScrollError();t=void 0===t?this.vuescroll.state.internalScrollLeft||0:getNumericValue(t,this.scrollPanelElm.scrollWidth),i=void 0===i?this.vuescroll.state.internalScrollTop||0:getNumericValue(i,this.scrollPanelElm.scrollHeight-l),this.internalScrollTo(t,i,o,r)},scrollBy:function(e){var t=e.dx,i=void 0===t?0:t,o=e.dy,r=void 0===o?0:o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=getScrollError(),n=this.vuescroll.state,a=n.internalScrollLeft,c=void 0===a?0:a,h=n.internalScrollTop,_=void 0===h?0:h;i&&(c+=getNumericValue(i,this.scrollPanelElm.scrollWidth)),r&&(_+=getNumericValue(r,this.scrollPanelElm.scrollHeight-s)),this.internalScrollTo(c,_,l)},zoomBy:function(e,t,i,o,r){"slide"==this.mode?this.scroller.zoomBy(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments[2],o=arguments[3],r=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},getCurrentviewDom:function(){for(var e=this,t=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,i=[],o=function(t){var i=t.getBoundingClientRect(),o=i.left,r=i.top,l=i.width,s=i.height,n=e.$el.getBoundingClientRect(),a=n.left,c=n.top,h=n.height,_=n.width;return o-a+l>0&&o-a<_&&r-c+s>0&&r-c1&&void 0!==arguments[1])||arguments[1],i=this.$el;if("string"==typeof e&&(e=i.querySelector(e)),isChildInParent(e,i)){var o=this.$el.getBoundingClientRect(),r=o.left,l=o.top,s=e.getBoundingClientRect(),n=r-s.left,a=l-s.top;this.scrollBy({dx:-n,dy:-a},t)}else log.warn("[vuescroll]: The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")}}},nativeMode={methods:{updateNativeModeBarState:function(){var e=getScrollError(),t=this.scrollPanelElm,i=this.$el,o=100*i.clientHeight/(t.scrollHeight-e),r=100*i.clientWidth/t.scrollWidth;this.bar.vBar.state.posValue=100*(t.scrollTop-e)/i.clientHeight,this.bar.hBar.state.posValue=100*t.scrollLeft/i.clientWidth,this.bar.vBar.state.size=o<100?o+"%":0,this.bar.hBar.state.size=r<100?r+"%":0}}},animatingMethod=null,noAnimatingMethod=null;function Scroller(e,t){for(var i in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:NOOP,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[i]=t[i];animatingMethod=createEasingFunction(this.options.animatingEasing,easingPattern),noAnimatingMethod=createEasingFunction(this.options.noAnimatingEasing,easingPattern)}var members={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,i,o){e===+e&&(this.__clientWidth=e),t===+t&&(this.__clientHeight=t),i===+i&&(this.__contentWidth=i),o===+o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__refreshHeight=e,this.__refreshActivate=i,this.__refreshBeforeDeactivate=l,this.__refreshDeactivate=o,this.__refreshStart=r},activatePushToLoad:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__loadHeight=e,this.__loadActivate=i,this.__loadBeforeDeactivate=l,this.__loadDeactivate=o,this.__loadStart=r},triggerRefreshOrLoad:function(){"refresh"==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"refresh")?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart())},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,i,o,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1);var l=this.__zoomLevel;null==i&&(i=this.__clientWidth/2),null==o&&(o=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);var s=(i+this.__scrollLeft)*e/l-i,n=(o+this.__scrollTop)*e/l-o;s>this.__maxScrollLeft?s=this.__maxScrollLeft:s<0&&(s=0),n>this.__maxScrollTop?n=this.__maxScrollTop:n<0&&(n=0),this.__publish(s,n,e,t)},zoomBy:function(e,t,i,o,r){this.zoomTo(this.__zoomLevel*e,t,i,o,r)},scrollTo:function(e,t,i,o,r){if(this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1),null!=o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=o,t*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX||r?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY||r?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(i=!1),this.__isTracking||this.__publish(e,t,o,i)},scrollBy:function(e,t,i){var o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(e||0),r+(t||0),i)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var i=e.x,o=e.y;isNaN(i)&&(i=1),isNaN(o)&&(o=1),this.scrollTo((i-1)*this.__clientWidth,(o-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,i,o){var r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,i-this.__clientLeft,o-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1,this.__interruptedAnimation=!0),this.__isAnimating&&(core.effect.Animate.stop(this.__isAnimating),this.__isAnimating=!1,this.__interruptedAnimation=!0);var r=1===e.length;r?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=i,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=i,this.__lastTouchTop=o,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]},doTouchMove:function(e,t,i){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){var o,r;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,r=e[0].pageY);var l=this.__positions;if(this.__isDragging){var s=o-this.__lastTouchLeft,n=r-this.__lastTouchTop,a=this.__scrollLeft,c=this.__scrollTop,h=this.__zoomLevel;if(null!=i&&this.options.zooming){var _=h;if(h=h/this.__lastScale*i,_!==(h=Math.max(Math.min(h,this.options.maxZoom),this.options.minZoom))){var d=o-this.__clientLeft,u=r-this.__clientTop;a=(d+a)*h/_-d,c=(u+c)*h/_-u,this.__computeScrollMax(h)}}if(this.__enableScrollX){a-=s*this.options.speedMultiplier;var p=this.__maxScrollLeft;(a>p||a<0)&&(this.options.bouncing?a+=s/2*this.options.speedMultiplier:a=a>p?p:0)}if(this.__enableScrollY){c-=n*this.options.speedMultiplier;var f=this.__maxScrollTop;(c>f||c<0)&&(this.options.bouncing?(c+=n/2*this.options.speedMultiplier,this.__enableScrollX||null==this.__refreshHeight&&null==this.__loadHeight||(!this.__refreshActive&&c<=-this.__refreshHeight?(this.__refreshActive=!0,this.__refreshActivate&&this.__refreshActivate()):this.__refreshActive&&c>-this.__refreshHeight?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):!this.__loadActive&&c>=this.__maxScrollTop+this.__loadHeight?(this.__loadActive=!0,this.__loadActivate&&this.__loadActivate()):this.__refreshActive&&cf?f:0)}l.length>60&&l.splice(0,30),l.push(a,c,t),this.__publish(a,c,h)}else{var m=this.options.locking?3:0,v=Math.abs(o-this.__initialTouchLeft),g=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&v>=m,this.__enableScrollY=this.options.scrollingY&&g>=m,l.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(v>=5||g>=5),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=i}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){for(var t=this.__positions,i=t.length-1,o=i,r=i;r>0&&t[r]>this.__lastTouchMove-100;r-=3)o=r;if(o!==i){var l=t[i]-t[o],s=this.__scrollLeft-t[o-2],n=this.__scrollTop-t[o-1];this.__decelerationVelocityX=s/l*(1e3/60),this.__decelerationVelocityY=n/l*(1e3/60);var a=this.options.paging||this.options.snapping?4:1;Math.abs(this.__decelerationVelocityX)>a||Math.abs(this.__decelerationVelocityY)>a?this.__refreshActive||this.__loadActive||this.__startDeceleration(e):this.__scrollComplete()}else this.__scrollComplete()}else e-this.__lastTouchMove>100&&this.__scrollComplete();this.__isDecelerating||(this.__refreshActive&&this.__refreshStart?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):this.__loadActive&&this.__loadStart?(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart()):((this.__interruptedAnimation||this.__isDragging)&&this.__scrollComplete(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel),this.__refreshActive?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):this.__loadActive&&(this.__loadActive=!1,this.__loadDeactivate&&this.__loadDeactivate()))),this.__positions.length=0}},onScroll:NOOP,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,i,o){var r=this;if(!r.__disable){!isNaN(e)&&e||(e=this.__scrollLeft),!isNaN(t)&&t||(t=this.__scrollTop);var l=r.__isAnimating;if(l&&(core.effect.Animate.stop(l),r.__isAnimating=!1),o&&r.options.animating){r.__scheduledLeft=e,r.__scheduledTop=t,r.__scheduledZoom=i;var s=r.__scrollLeft,n=r.__scrollTop,a=r.__zoomLevel,c=e-s,h=t-n,_=i-a;r.__isAnimating=core.effect.Animate.start(function(e,t,i){i&&(r.__scrollLeft=s+c*e,r.__scrollTop=n+h*e,r.__zoomLevel=a+_*e,r.__callback&&(r.__callback(r.__scrollLeft,r.__scrollTop,r.__zoomLevel),r.onScroll()))},function(e){return r.__isAnimating===e},function(e,t,i){t===r.__isAnimating&&(r.__isAnimating=!1),(r.__didDecelerationComplete||i)&&r.__scrollComplete(),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))},r.options.animationDuration,l?animatingMethod:noAnimatingMethod)}else r.__scheduledLeft=r.__scrollLeft=e,r.__scheduledTop=r.__scrollTop=t,r.__scheduledZoom=r.__zoomLevel=i,r.__callback&&(r.__callback(e,t,i),r.onScroll()),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))}},__computeScrollMax:function(e){null==e&&(e=this.__zoomLevel),this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)},__computePage:function(){var e=this.__clientWidth,t=this.__clientHeight,i=this.__scrollLeft,o=this.__scrollTop;this.__totalXPage=Math.ceil(this.__contentWidth/e),this.__currentPageX=Math.ceil(i/e+1),this.__totalYPage=Math.ceil(this.__contentHeight/t),this.__currentPageY=Math.ceil(o/t+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),i=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),o=e.__clientWidth,r=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/o)*o,e.__minDecelerationScrollTop=Math.floor(i/r)*r,e.__maxDecelerationScrollLeft=Math.ceil(t/o)*o,e.__maxDecelerationScrollTop=Math.ceil(i/r)*r}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop;var l=e.options.snapping?4:.001;e.__isDecelerating=core.effect.Animate.start(function(t,i,o){e.__stepThroughDeceleration(o)},function(){var t=Math.abs(e.__decelerationVelocityX)>=l||Math.abs(e.__decelerationVelocityY)>=l;return t||(e.__didDecelerationComplete=!0),t},function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollComplete(),e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)})},__stepThroughDeceleration:function(e){var t=this.__scrollLeft+this.__decelerationVelocityX,i=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){var o=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);o!==t&&(t=o,this.__decelerationVelocityX=0);var r=Math.max(Math.min(this.__maxDecelerationScrollTop,i),this.__minDecelerationScrollTop);r!==i&&(i=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,i,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=i),!this.options.paging){this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95}if(this.options.bouncing){var l=0,s=0,n=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;tthis.__maxDecelerationScrollLeft&&(l=this.__maxDecelerationScrollLeft-t),ithis.__maxDecelerationScrollTop&&(s=this.__maxDecelerationScrollTop-i),0!==l&&(l*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=l*n:this.__decelerationVelocityX=l*a),0!==s&&(s*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=s*n:this.__decelerationVelocityY=s*a)}}};for(var key in members)Scroller.prototype[key]=members[key];function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function render(e,t,i,o){var r,l=document.documentElement.style,s=null,n=null;t.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?r="presto":"MozAppearance"in l?r="gecko":"WebkitAppearance"in l?r="webkit":"string"==typeof navigator.cpuClass&&(r="trident"),"string"==typeof e&&(n="vertical"==e?(s=0)||o:(s=o)&&0);var a={trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[r],c=document.createElement("div"),h=a+"Perspective";return void 0!==c.style[h]?"string"==typeof e?_defineProperty({},"transform","translate3d("+s+i+","+n+i+",0)"):function(t,o,r){e.style.transform="translate3d("+-t+i+","+-o+i+",0) scale("+r+")"}:void 0!==c.style.transform?"string"==typeof e?_defineProperty({},"transform","translate("+s+i+","+n+i+")"):function(t,o,r){e.style.transform="translate("+-t+i+","+-o+i+") scale("+r+")"}:void 0}function listenContainer(e,t,i,o,r){var l=null;function s(e){e.touches[0]&&e.touches[0].target&&e.touches[0].target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart(e.touches,e.timeStamp),r&&e.preventDefault(),document.addEventListener("touchmove",n,{passive:!1}))}function n(e){i("mousemove"),t.doTouchMove(e.touches,e.timeStamp,e.scale),e.preventDefault()}function a(e){i("mouseup"),t.doTouchEnd(e.timeStamp),document.removeEventListener("touchmove",n)}function c(e){t.doTouchEnd(e.timeStamp)}function h(e){e.target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),r&&e.preventDefault(),p=!0)}function _(e){p&&(i("mousemove"),t.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),p=!0)}function d(e){p&&(i("mouseup"),t.doTouchEnd(e.timeStamp),p=!1)}function u(e){t.doMouseZoom(e.detail?-120*e.detail:e.wheelDelta,e.timeStamp,e.pageX,e.pageY)}if("ontouchstart"in window)e.addEventListener("touchstart",s,!1),document.addEventListener("touchend",a,!1),document.addEventListener("touchcancel",c,!1),l=function(){e.removeEventListener("touchstart",s,!1),document.removeEventListener("touchend",a,!1),document.removeEventListener("touchcancel",c,!1)};else{var p=!1;e.addEventListener("mousedown",h,!1),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",d,!1),o&&e.addEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1),l=function(){e.removeEventListener("mousedown",h,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",d,!1),e.removeEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1)}}return t.onScroll=function(){i("onscroll")},l}var _extends=Object.assign||function(e){for(var t=1;to.__maxScrollLeft&&(r=o.__scrollLeft-o.__maxScrollLeft)),_&&(o.__scrollTop<0?l=-o.__scrollTop:o.__scrollTop>o.__maxScrollTop&&(l=o.__scrollTop-o.__maxScrollTop)),e=100*n/(c+l),t=100*s/(a+r);var d=Math.min(Math.max(0,o.__scrollTop),o.__maxScrollTop),u=Math.min(Math.max(0,o.__scrollLeft),o.__maxScrollLeft);this.bar.vBar.state.posValue=100*(d+l)/i.clientHeight,this.bar.hBar.state.posValue=100*(u+r)/i.clientWidth,o.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),o.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t="refresh"==e?"refreshDom":"loadDom",i="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,o="refresh"==e?"refreshStage":"loadStage",r=this.$refs[t].elm||this.$refs[t],l=createStateCallbacks(e,o,this,r),s=r.offsetHeight;i.bind(this.scroller)(s,l)}}},map={vertical:{bar:{size:"height",opsSize:"width",posName:"top",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY"},axis:"Y"},horizontal:{bar:{size:"width",opsSize:"height",posName:"left",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX"},axis:"X"}},_extends$1=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null;"native"==this.mode||"pure-native"==this.mode?this.updateNativeModeBarState():"slide"==this.mode&&this.updateSlideModeBarState(),e&&this.emitEvent(e,t)},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e),this.showAndDefferedHideBar()},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.vuescroll.state.timeoutId&&clearTimeout(this.vuescroll.state.timeoutId),this.vuescroll.state.timeoutId=setTimeout(function(){e.vuescroll.state.timeoutId=0,e.hideBar()},500)},emitEvent:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.scrollPanelElm,o=i.scrollHeight,r=i.scrollWidth,l=i.clientHeight,s=i.clientWidth,n=i.scrollTop,a=i.scrollLeft,c={type:"vertical"},h={type:"horizontal"};"slide"==this.mode&&(n=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,l=this.$el.clientHeight,s=this.$el.clientWidth),c.process=Math.min(n/(o-l),1),h.process=Math.min(a/(r-s),1),c.barSize=this.bar.vBar.state.size,h.barSize=this.bar.hBar.state.size,c.scrollTop=n,h.scrollLeft=a,this.$emit(e,c,h,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var e=this;this.destroyResize&&this.destroyResize();var t=null;"slide"==this.mode||"pure-native"==this.mode?t=this.scrollPanelElm:"native"==this.mode&&(t=this.scrollContentElm);var i=function(){e.updateBarStateAndEmitEvent(),e.showAndDefferedHideBar(),"slide"==e.mode&&e.updateScroller()};window.addEventListener("resize",i,!1);var o=listenResize(t,function(){var t={};"slide"==e.mode?(e.updateScroller(),t.width=e.scroller.__contentWidth,t.height=e.scroller.__contentHeight):"native"!=e.mode&&"pure-native"!=e.mode||(t.width=e.scrollPanelElm.scrollWidth,t.height=e.scrollPanelElm.scrollHeight),e.updateBarStateAndEmitEvent("handle-resize",t),e.showAndDefferedHideBar()});this.destroyResize=function(){window.removeEventListener("resize",i,!1),o()}},registryParentResize:function(){this.destroyParentDomResize=listenResize(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.clientHeight+"px",this.vuescroll.state.width=e.clientWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=findValuesByMode(e,this);this.vuescroll.state.internalScrollLeft=t.x,this.vuescroll.state.internalScrollTop=t.y},initWatch:function(){var e=this,t={deep:!0,sync:!0};this.$watch("mergedOptions",function(){e.recordCurrentPos(),e.$nextTick(function(){1!=e.isSmallChangeThisTick?(e.registryResize(),e.updateMode(),e.setVsSize()):e.isSmallChangeThisTick=!1})},t),smallChangeArray.forEach(function(i){e.$watch(i,function(){e.isSmallChangeThisTick=!0},t)})},scrollToHash:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||function(e){return/^#[a-zA-Z_]\d*$/.test(e)}(e))){var t=document.querySelector(e);!isChildInParent(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}}},mounted:function(){this.renderError||("slide"==this.mode&&(this.destroyScroller=this.registryScroller()),this.$el._isVuescroll=!0,this.lastMode=this.mode,this.registryResize(),this.initWatch(),this.setVsSize(),this.updateBarStateAndEmitEvent(),this.showAndDefferedHideBar(),this.scrollToHash())},updated:function(){var e=this;this.$nextTick(function(){e._isDestroyed||e.showAndDefferedHideBar()})},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)}},Vuescroll={install:function(e){e.component(vueScrollCore.name,vueScrollCore),e.prototype.$vuescrollConfig=deepMerge(GCF,{})},version:"4.5.18"};"undefined"!=typeof window&&window.Vue&&Vue.use(Vuescroll),module.exports=Vuescroll; \ No newline at end of file diff --git a/dist/vuescroll.esm.js b/dist/vuescroll.esm.js index 8da53238..1b4643df 100644 --- a/dist/vuescroll.esm.js +++ b/dist/vuescroll.esm.js @@ -124,14 +124,14 @@ function eventCenter(dom, eventName, hander) { var log = console; var error = void 0; -// It only happens when child is inline-block, +// It only happens when child is inline-block in chrome, // scollheight will have a error of -// 4px in chrome or some other browsers. -// So write a method to get the error and get the real scrollHeight. -function getRealScrollHeight(scrollHeight) { +// 4px, so write a method to compute the error. +// https://stackoverflow.com/questions/29132892/how-to-auto-resize-an-input-field-vertically-and-not-horizontally-like-facebook/29133328#29133328 +function getScrollError() { /* istanbul ignore next */ if (Vue.prototype.$isServer) return 0; - if (error !== undefined) return scrollHeight - error; + if (error !== undefined) return error; var outer = document.createElement('div'); outer.style.visibility = 'hidden'; outer.style.height = '100px'; @@ -146,7 +146,7 @@ function getRealScrollHeight(scrollHeight) { outer.appendChild(inner); error = outer.scrollHeight - outer.clientHeight; outer.parentNode.removeChild(outer); - return scrollHeight - error; + return error; } function isChildInParent(child, parent) { @@ -671,7 +671,8 @@ function goScrolling(elm, deltaX, deltaY, speed, easing, scrollingComplete) { if (startLocationY + deltaY < 0) { deltaY = -startLocationY; } - var scrollHeight = getRealScrollHeight(elm['scrollHeight']); + var error = getScrollError(); + var scrollHeight = elm['scrollHeight'] - error; if (startLocationY + deltaY > scrollHeight) { deltaY = scrollHeight - startLocationY; } @@ -707,6 +708,7 @@ var api = { var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var error = getScrollError(); if (typeof x === 'undefined') { x = this.vuescroll.state.internalScrollLeft || 0; } else { @@ -715,7 +717,7 @@ var api = { if (typeof y === 'undefined') { y = this.vuescroll.state.internalScrollTop || 0; } else { - y = getNumericValue(y, getRealScrollHeight(this.scrollPanelElm.scrollHeight)); + y = getNumericValue(y, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(x, y, animate, force); }, @@ -725,6 +727,8 @@ var api = { _ref2$dy = _ref2.dy, dy = _ref2$dy === undefined ? 0 : _ref2$dy; var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var error = getScrollError(); var _vuescroll$state = this.vuescroll.state, _vuescroll$state$inte = _vuescroll$state.internalScrollLeft, internalScrollLeft = _vuescroll$state$inte === undefined ? 0 : _vuescroll$state$inte, @@ -735,7 +739,7 @@ var api = { internalScrollLeft += getNumericValue(dx, this.scrollPanelElm.scrollWidth); } if (dy) { - internalScrollTop += getNumericValue(dy, getRealScrollHeight(this.scrollPanelElm.scrollHeight)); + internalScrollTop += getNumericValue(dy, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(internalScrollLeft, internalScrollTop, animate); }, @@ -867,11 +871,12 @@ var api = { var nativeMode = { methods: { updateNativeModeBarState: function updateNativeModeBarState() { + var error = getScrollError(); var scrollPanel = this.scrollPanelElm; var vuescroll = this.$el; - var heightPercentage = vuescroll.clientHeight * 100 / getRealScrollHeight(scrollPanel.scrollHeight); + var heightPercentage = vuescroll.clientHeight * 100 / (scrollPanel.scrollHeight - error); var widthPercentage = vuescroll.clientWidth * 100 / scrollPanel.scrollWidth; - this.bar.vBar.state.posValue = scrollPanel.scrollTop * 100 / vuescroll.clientHeight; + this.bar.vBar.state.posValue = (scrollPanel.scrollTop - error) * 100 / vuescroll.clientHeight; this.bar.hBar.state.posValue = scrollPanel.scrollLeft * 100 / vuescroll.clientWidth; this.bar.vBar.state.size = heightPercentage < 100 ? heightPercentage + '%' : 0; this.bar.hBar.state.size = widthPercentage < 100 ? widthPercentage + '%' : 0; @@ -2844,6 +2849,7 @@ var scrollContent = { slots = _ref.slots; var style = deepMerge(props.state.style, {}); + var error = getScrollError(); style.position = 'relative'; style.minHeight = '100%'; style.minWidth = '100%'; @@ -2852,6 +2858,9 @@ var scrollContent = { if (props.ops.padding) { style[props.ops.paddPos] = props.ops.paddValue; } + if (error) { + style.marginBottom = '-' + error + 'px'; + } return h(props.ops.tag, { style: style, ref: 'scrollContent', diff --git a/dist/vuescroll.esm.min.js b/dist/vuescroll.esm.min.js index 396f102a..563663a5 100644 --- a/dist/vuescroll.esm.min.js +++ b/dist/vuescroll.esm.min.js @@ -5,4 +5,4 @@ * @license: MIT * @GitHub: https://github.com/wangyi7099/vuescroll */ -import Vue from"vue";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function deepCopy(e,t){for(var i in t="object"===(void 0===t?"undefined":_typeof(t))&&t||{},e)t[i]="object"===_typeof(e[i])?deepCopy(e[i],t[i]={}):e[i];return t}function deepMerge(e,t){for(var i in t=t||{},e)"object"===_typeof(e[i])?void 0===t[i]?(t[i]={},deepCopy(e[i],t[i])):deepMerge(e[i],t[i]):void 0===t[i]&&(t[i]=e[i]);return t}function defineReactive(e,t,i,o){var r=null;(i[t]||"function"==typeof i)&&(o=o||t,"function"==typeof i&&(r=i),Object.defineProperty(e,t,{get:r||function(){return i[o]},configurable:!0}))}var scrollBarWidth=void 0;function getGutter(){if(Vue.prototype.$isServer)return 0;if(void 0!==scrollBarWidth)return scrollBarWidth;var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var i=document.createElement("div");i.style.width="100%",e.appendChild(i);var o=i.offsetWidth;return e.parentNode.removeChild(e),scrollBarWidth=t-o}var doneUtil={refreshDomStyle:!1,loadDomStyle:!1,hide:!1};function hideSystemBar(){if(!doneUtil.hide){doneUtil.hide=!0;var e=document.createElement("style");e.type="text/css",e.innerHTML=".vuescroll-panel::-webkit-scrollbar{width:0;height:0}",document.getElementsByTagName("HEAD").item(0).appendChild(e)}}var styleMap={};function createDomStyle(e){if(!doneUtil[e]){doneUtil[e]=!0;var t=document.createElement("style");t.type="text/css",t.innerHTML=styleMap[e],document.getElementsByTagName("HEAD").item(0).appendChild(t)}}function eventCenter(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"on"==(arguments.length>4&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,i,o):e.removeEventListener(t,i,o)}styleMap.refreshDomStyle="\n.vuescroll-refresh {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-refresh svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-refresh svg path,\n.vuescroll-refresh svg rect{\nfill: #FF6700;\n}\n",styleMap.loadDomStyle="\n.vuescroll-load {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-load svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-load svg path,\n.vuescroll-load svg rect{\nfill: #FF6700;\n}\n";var log=console,error=void 0;function getRealScrollHeight(e){if(Vue.prototype.$isServer)return 0;if(void 0!==error)return e-error;var t=document.createElement("div");t.style.visibility="hidden",t.style.height="100px",t.style.position="absolute",t.style.top="-9999px",t.style.overflow="hidden",document.body.appendChild(t);var i=document.createElement("div");return i.style.visibility="hidden",i.style.height="100px",i.style.display="inline-block",t.appendChild(i),error=t.scrollHeight-t.clientHeight,t.parentNode.removeChild(t),e-error}function isChildInParent(e,t){var i=!1;if(!e||!t)return i;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(i=!0),i}function listenResize(e,t){var i=document.createElement("object");return i.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i.tabIndex=-1,i.type="text/html",i.data="about:blank",i.isResizeElm=!0,i.onload=function(){eventCenter(i.contentDocument.defaultView,"resize",t)},e.appendChild(i),function(){i.contentDocument&&eventCenter(i.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i)}}var modes=["slide","native","pure-native"],NOOP=function(){},smallChangeArray=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],GCF={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{tag:"div",padding:!1,props:{},attrs:{}},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{vBar:{background:"#00a650",deltaY:100,keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};function validateOptions(e){var t=!1,i=e.vuescroll,o=e.scrollPanel;~modes.indexOf(i.mode)||(log.error('[vuescroll]: The vuescroll\'s option "mode" should be one of the '+modes),t=!0),i.paging==i.snapping.enable&&i.paging&&(i.pullRefresh||i.pushLoad)&&log.error("[vuescroll]: paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var r=o.initialScrollY,l=o.initialScrollX;return r&&!String(r).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}function hackPropsData(){var e=this;if("vueScroll"===e.$options.name){var t=deepMerge(e.$vuescrollConfig,{}),i=deepMerge(GCF,t);e.$options.propsData.ops=e.$options.propsData.ops||{},Object.keys(e.$options.propsData.ops).forEach(function(t){defineReactive(e.mergedOptions,t,e.$options.propsData.ops)}),deepMerge(i,e.mergedOptions),defineReactive(e.mergedOptions.bar.vBar,"pos",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.vBar,"width",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.hBar,"pos",e.mergedOptions.rail.hRail),defineReactive(e.mergedOptions.bar.hBar,"height",e.mergedOptions.rail.hRail);defineReactive(e.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+e.mergedOptions.rail.vRail.pos}),defineReactive(e.mergedOptions.scrollContent,"paddValue",function(){return e.mergedOptions.rail.vRail.width})}}var hackLifecycle={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){hackPropsData.call(this),this.renderError=validateOptions(this.mergedOptions)}};function createEasingFunction(e,t){return function(i){return t(e,i)}}function easingPattern(e,t){var i=null;return"easeInQuad"===e&&(i=t*t),"easeOutQuad"===e&&(i=t*(2-t)),"easeInOutQuad"===e&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(i=t*t*t),"easeOutCubic"===e&&(i=--t*t*t+1),"easeInOutCubic"===e&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(i=t*t*t*t),"easeOutQuart"===e&&(i=1- --t*t*t*t),"easeInOutQuart"===e&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(i=t*t*t*t*t),"easeOutQuint"===e&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),i||t}function requestAnimationFrame(e){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,i=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(i=!1),i)return function(e,i){t(e,i)};var o={},r=1,l=null,s=+new Date;return function(e){var t=r++;return o[t]=e,requestCount++,null===l&&(l=setInterval(function(){var e=+new Date,t=o;for(var i in o={},requestCount=0,t)t.hasOwnProperty(i)&&(t[i](e),s=e);e-s>2500&&(clearInterval(l),l=null)},1e3/60)),t}}var time=Date.now||function(){return+new Date},desiredFrames=60,millisecondsPerSecond=1e3,running={},counter=1,core={effect:{}},global=null;function getNumericValue(e,t){var i=void 0;return i=(i=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(i=i[1]-0)/100:e-0}function goScrolling(e,t,i,o,r,l){var s=e.scrollTop,n=e.scrollLeft,a=n,c=s;s+i<0&&(i=-s);var h=getRealScrollHeight(e.scrollHeight);s+i>h&&(i=h-s),n+t<0&&(t=-n),n+t>e.scrollWidth&&(t=e.scrollWidth-n);var _=createEasingFunction(r,easingPattern);core.effect.Animate.start(function(o){a=n+t*o,c=s+i*o,e.scrollTop=Math.floor(c),e.scrollLeft=Math.floor(a)},function(){return Math.abs(c-s)<=Math.abs(i)||Math.abs(a-n)<=Math.abs(t)},l,o,_)}global="undefined"!=typeof window?window:{},core.effect.Animate={requestAnimationFrame:requestAnimationFrame(global),stop:function(e){var t=null!=running[e];return t&&(running[e]=null),t},isRunning:function(e){return null!=running[e]},start:function(e,t,i,o,r,l){var s=time(),n=s,a=0,c=0,h=counter++;if(l||(l=document.body),h%20==0){var _={};for(var d in running)_[d]=!0;running=_}return running[h]=!0,core.effect.Animate.requestAnimationFrame(function _(d){var u=!0!==d,p=time();if(!running[h]||t&&!t(h))return running[h]=null,void(i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,!1));if(u)for(var f=Math.round((p-n)/(millisecondsPerSecond/desiredFrames))-1,m=0;m1&&(a=1);var v=r?r(a):a;!1!==e(v,p,u)&&1!==a||!u?u&&(n=p,core.effect.Animate.requestAnimationFrame(_,l)):(running[h]=null,i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,1===a||null==o))},l),h}};var api={methods:{scrollTo:function(e){var t=e.x,i=e.y,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=void 0===t?this.vuescroll.state.internalScrollLeft||0:getNumericValue(t,this.scrollPanelElm.scrollWidth),i=void 0===i?this.vuescroll.state.internalScrollTop||0:getNumericValue(i,getRealScrollHeight(this.scrollPanelElm.scrollHeight)),this.internalScrollTo(t,i,o,r)},scrollBy:function(e){var t=e.dx,i=void 0===t?0:t,o=e.dy,r=void 0===o?0:o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=this.vuescroll.state,n=s.internalScrollLeft,a=void 0===n?0:n,c=s.internalScrollTop,h=void 0===c?0:c;i&&(a+=getNumericValue(i,this.scrollPanelElm.scrollWidth)),r&&(h+=getNumericValue(r,getRealScrollHeight(this.scrollPanelElm.scrollHeight))),this.internalScrollTo(a,h,l)},zoomBy:function(e,t,i,o,r){"slide"==this.mode?this.scroller.zoomBy(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments[2],o=arguments[3],r=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},getCurrentviewDom:function(){for(var e=this,t=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,i=[],o=function(t){var i=t.getBoundingClientRect(),o=i.left,r=i.top,l=i.width,s=i.height,n=e.$el.getBoundingClientRect(),a=n.left,c=n.top,h=n.height,_=n.width;return o-a+l>0&&o-a<_&&r-c+s>0&&r-c1&&void 0!==arguments[1])||arguments[1],i=this.$el;if("string"==typeof e&&(e=i.querySelector(e)),isChildInParent(e,i)){var o=this.$el.getBoundingClientRect(),r=o.left,l=o.top,s=e.getBoundingClientRect(),n=r-s.left,a=l-s.top;this.scrollBy({dx:-n,dy:-a},t)}else log.warn("[vuescroll]: The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")}}},nativeMode={methods:{updateNativeModeBarState:function(){var e=this.scrollPanelElm,t=this.$el,i=100*t.clientHeight/getRealScrollHeight(e.scrollHeight),o=100*t.clientWidth/e.scrollWidth;this.bar.vBar.state.posValue=100*e.scrollTop/t.clientHeight,this.bar.hBar.state.posValue=100*e.scrollLeft/t.clientWidth,this.bar.vBar.state.size=i<100?i+"%":0,this.bar.hBar.state.size=o<100?o+"%":0}}},animatingMethod=null,noAnimatingMethod=null;function Scroller(e,t){for(var i in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:NOOP,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[i]=t[i];animatingMethod=createEasingFunction(this.options.animatingEasing,easingPattern),noAnimatingMethod=createEasingFunction(this.options.noAnimatingEasing,easingPattern)}var members={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,i,o){e===+e&&(this.__clientWidth=e),t===+t&&(this.__clientHeight=t),i===+i&&(this.__contentWidth=i),o===+o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__refreshHeight=e,this.__refreshActivate=i,this.__refreshBeforeDeactivate=l,this.__refreshDeactivate=o,this.__refreshStart=r},activatePushToLoad:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__loadHeight=e,this.__loadActivate=i,this.__loadBeforeDeactivate=l,this.__loadDeactivate=o,this.__loadStart=r},triggerRefreshOrLoad:function(){"refresh"==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"refresh")?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart())},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,i,o,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1);var l=this.__zoomLevel;null==i&&(i=this.__clientWidth/2),null==o&&(o=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);var s=(i+this.__scrollLeft)*e/l-i,n=(o+this.__scrollTop)*e/l-o;s>this.__maxScrollLeft?s=this.__maxScrollLeft:s<0&&(s=0),n>this.__maxScrollTop?n=this.__maxScrollTop:n<0&&(n=0),this.__publish(s,n,e,t)},zoomBy:function(e,t,i,o,r){this.zoomTo(this.__zoomLevel*e,t,i,o,r)},scrollTo:function(e,t,i,o,r){if(this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1),null!=o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=o,t*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX||r?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY||r?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(i=!1),this.__isTracking||this.__publish(e,t,o,i)},scrollBy:function(e,t,i){var o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(e||0),r+(t||0),i)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var i=e.x,o=e.y;isNaN(i)&&(i=1),isNaN(o)&&(o=1),this.scrollTo((i-1)*this.__clientWidth,(o-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,i,o){var r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,i-this.__clientLeft,o-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1,this.__interruptedAnimation=!0),this.__isAnimating&&(core.effect.Animate.stop(this.__isAnimating),this.__isAnimating=!1,this.__interruptedAnimation=!0);var r=1===e.length;r?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=i,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=i,this.__lastTouchTop=o,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]},doTouchMove:function(e,t,i){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){var o,r;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,r=e[0].pageY);var l=this.__positions;if(this.__isDragging){var s=o-this.__lastTouchLeft,n=r-this.__lastTouchTop,a=this.__scrollLeft,c=this.__scrollTop,h=this.__zoomLevel;if(null!=i&&this.options.zooming){var _=h;if(h=h/this.__lastScale*i,_!==(h=Math.max(Math.min(h,this.options.maxZoom),this.options.minZoom))){var d=o-this.__clientLeft,u=r-this.__clientTop;a=(d+a)*h/_-d,c=(u+c)*h/_-u,this.__computeScrollMax(h)}}if(this.__enableScrollX){a-=s*this.options.speedMultiplier;var p=this.__maxScrollLeft;(a>p||a<0)&&(this.options.bouncing?a+=s/2*this.options.speedMultiplier:a=a>p?p:0)}if(this.__enableScrollY){c-=n*this.options.speedMultiplier;var f=this.__maxScrollTop;(c>f||c<0)&&(this.options.bouncing?(c+=n/2*this.options.speedMultiplier,this.__enableScrollX||null==this.__refreshHeight&&null==this.__loadHeight||(!this.__refreshActive&&c<=-this.__refreshHeight?(this.__refreshActive=!0,this.__refreshActivate&&this.__refreshActivate()):this.__refreshActive&&c>-this.__refreshHeight?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):!this.__loadActive&&c>=this.__maxScrollTop+this.__loadHeight?(this.__loadActive=!0,this.__loadActivate&&this.__loadActivate()):this.__refreshActive&&cf?f:0)}l.length>60&&l.splice(0,30),l.push(a,c,t),this.__publish(a,c,h)}else{var m=this.options.locking?3:0,v=Math.abs(o-this.__initialTouchLeft),g=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&v>=m,this.__enableScrollY=this.options.scrollingY&&g>=m,l.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(v>=5||g>=5),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=i}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){for(var t=this.__positions,i=t.length-1,o=i,r=i;r>0&&t[r]>this.__lastTouchMove-100;r-=3)o=r;if(o!==i){var l=t[i]-t[o],s=this.__scrollLeft-t[o-2],n=this.__scrollTop-t[o-1];this.__decelerationVelocityX=s/l*(1e3/60),this.__decelerationVelocityY=n/l*(1e3/60);var a=this.options.paging||this.options.snapping?4:1;Math.abs(this.__decelerationVelocityX)>a||Math.abs(this.__decelerationVelocityY)>a?this.__refreshActive||this.__loadActive||this.__startDeceleration(e):this.__scrollComplete()}else this.__scrollComplete()}else e-this.__lastTouchMove>100&&this.__scrollComplete();this.__isDecelerating||(this.__refreshActive&&this.__refreshStart?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):this.__loadActive&&this.__loadStart?(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart()):((this.__interruptedAnimation||this.__isDragging)&&this.__scrollComplete(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel),this.__refreshActive?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):this.__loadActive&&(this.__loadActive=!1,this.__loadDeactivate&&this.__loadDeactivate()))),this.__positions.length=0}},onScroll:NOOP,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,i,o){var r=this;if(!r.__disable){!isNaN(e)&&e||(e=this.__scrollLeft),!isNaN(t)&&t||(t=this.__scrollTop);var l=r.__isAnimating;if(l&&(core.effect.Animate.stop(l),r.__isAnimating=!1),o&&r.options.animating){r.__scheduledLeft=e,r.__scheduledTop=t,r.__scheduledZoom=i;var s=r.__scrollLeft,n=r.__scrollTop,a=r.__zoomLevel,c=e-s,h=t-n,_=i-a;r.__isAnimating=core.effect.Animate.start(function(e,t,i){i&&(r.__scrollLeft=s+c*e,r.__scrollTop=n+h*e,r.__zoomLevel=a+_*e,r.__callback&&(r.__callback(r.__scrollLeft,r.__scrollTop,r.__zoomLevel),r.onScroll()))},function(e){return r.__isAnimating===e},function(e,t,i){t===r.__isAnimating&&(r.__isAnimating=!1),(r.__didDecelerationComplete||i)&&r.__scrollComplete(),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))},r.options.animationDuration,l?animatingMethod:noAnimatingMethod)}else r.__scheduledLeft=r.__scrollLeft=e,r.__scheduledTop=r.__scrollTop=t,r.__scheduledZoom=r.__zoomLevel=i,r.__callback&&(r.__callback(e,t,i),r.onScroll()),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))}},__computeScrollMax:function(e){null==e&&(e=this.__zoomLevel),this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)},__computePage:function(){var e=this.__clientWidth,t=this.__clientHeight,i=this.__scrollLeft,o=this.__scrollTop;this.__totalXPage=Math.ceil(this.__contentWidth/e),this.__currentPageX=Math.ceil(i/e+1),this.__totalYPage=Math.ceil(this.__contentHeight/t),this.__currentPageY=Math.ceil(o/t+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),i=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),o=e.__clientWidth,r=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/o)*o,e.__minDecelerationScrollTop=Math.floor(i/r)*r,e.__maxDecelerationScrollLeft=Math.ceil(t/o)*o,e.__maxDecelerationScrollTop=Math.ceil(i/r)*r}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop;var l=e.options.snapping?4:.001;e.__isDecelerating=core.effect.Animate.start(function(t,i,o){e.__stepThroughDeceleration(o)},function(){var t=Math.abs(e.__decelerationVelocityX)>=l||Math.abs(e.__decelerationVelocityY)>=l;return t||(e.__didDecelerationComplete=!0),t},function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollComplete(),e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)})},__stepThroughDeceleration:function(e){var t=this.__scrollLeft+this.__decelerationVelocityX,i=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){var o=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);o!==t&&(t=o,this.__decelerationVelocityX=0);var r=Math.max(Math.min(this.__maxDecelerationScrollTop,i),this.__minDecelerationScrollTop);r!==i&&(i=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,i,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=i),!this.options.paging){this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95}if(this.options.bouncing){var l=0,s=0,n=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;tthis.__maxDecelerationScrollLeft&&(l=this.__maxDecelerationScrollLeft-t),ithis.__maxDecelerationScrollTop&&(s=this.__maxDecelerationScrollTop-i),0!==l&&(l*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=l*n:this.__decelerationVelocityX=l*a),0!==s&&(s*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=s*n:this.__decelerationVelocityY=s*a)}}};for(var key in members)Scroller.prototype[key]=members[key];function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function render(e,t,i,o){var r,l=document.documentElement.style,s=null,n=null;t.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?r="presto":"MozAppearance"in l?r="gecko":"WebkitAppearance"in l?r="webkit":"string"==typeof navigator.cpuClass&&(r="trident"),"string"==typeof e&&(n="vertical"==e?(s=0)||o:(s=o)&&0);var a={trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[r],c=document.createElement("div"),h=a+"Perspective";return void 0!==c.style[h]?"string"==typeof e?_defineProperty({},"transform","translate3d("+s+i+","+n+i+",0)"):function(t,o,r){e.style.transform="translate3d("+-t+i+","+-o+i+",0) scale("+r+")"}:void 0!==c.style.transform?"string"==typeof e?_defineProperty({},"transform","translate("+s+i+","+n+i+")"):function(t,o,r){e.style.transform="translate("+-t+i+","+-o+i+") scale("+r+")"}:void 0}function listenContainer(e,t,i,o,r){var l=null;function s(e){e.touches[0]&&e.touches[0].target&&e.touches[0].target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart(e.touches,e.timeStamp),r&&e.preventDefault(),document.addEventListener("touchmove",n,{passive:!1}))}function n(e){i("mousemove"),t.doTouchMove(e.touches,e.timeStamp,e.scale),e.preventDefault()}function a(e){i("mouseup"),t.doTouchEnd(e.timeStamp),document.removeEventListener("touchmove",n)}function c(e){t.doTouchEnd(e.timeStamp)}function h(e){e.target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),r&&e.preventDefault(),p=!0)}function _(e){p&&(i("mousemove"),t.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),p=!0)}function d(e){p&&(i("mouseup"),t.doTouchEnd(e.timeStamp),p=!1)}function u(e){t.doMouseZoom(e.detail?-120*e.detail:e.wheelDelta,e.timeStamp,e.pageX,e.pageY)}if("ontouchstart"in window)e.addEventListener("touchstart",s,!1),document.addEventListener("touchend",a,!1),document.addEventListener("touchcancel",c,!1),l=function(){e.removeEventListener("touchstart",s,!1),document.removeEventListener("touchend",a,!1),document.removeEventListener("touchcancel",c,!1)};else{var p=!1;e.addEventListener("mousedown",h,!1),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",d,!1),o&&e.addEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1),l=function(){e.removeEventListener("mousedown",h,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",d,!1),e.removeEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1)}}return t.onScroll=function(){i("onscroll")},l}var _extends=Object.assign||function(e){for(var t=1;to.__maxScrollLeft&&(r=o.__scrollLeft-o.__maxScrollLeft)),_&&(o.__scrollTop<0?l=-o.__scrollTop:o.__scrollTop>o.__maxScrollTop&&(l=o.__scrollTop-o.__maxScrollTop)),e=100*n/(c+l),t=100*s/(a+r);var d=Math.min(Math.max(0,o.__scrollTop),o.__maxScrollTop),u=Math.min(Math.max(0,o.__scrollLeft),o.__maxScrollLeft);this.bar.vBar.state.posValue=100*(d+l)/i.clientHeight,this.bar.hBar.state.posValue=100*(u+r)/i.clientWidth,o.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),o.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t="refresh"==e?"refreshDom":"loadDom",i="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,o="refresh"==e?"refreshStage":"loadStage",r=this.$refs[t].elm||this.$refs[t],l=createStateCallbacks(e,o,this,r),s=r.offsetHeight;i.bind(this.scroller)(s,l)}}},map={vertical:{bar:{size:"height",opsSize:"width",posName:"top",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY"},axis:"Y"},horizontal:{bar:{size:"width",opsSize:"height",posName:"left",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX"},axis:"X"}},_extends$1=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null;"native"==this.mode||"pure-native"==this.mode?this.updateNativeModeBarState():"slide"==this.mode&&this.updateSlideModeBarState(),e&&this.emitEvent(e,t)},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e),this.showAndDefferedHideBar()},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.vuescroll.state.timeoutId&&clearTimeout(this.vuescroll.state.timeoutId),this.vuescroll.state.timeoutId=setTimeout(function(){e.vuescroll.state.timeoutId=0,e.hideBar()},500)},emitEvent:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.scrollPanelElm,o=i.scrollHeight,r=i.scrollWidth,l=i.clientHeight,s=i.clientWidth,n=i.scrollTop,a=i.scrollLeft,c={type:"vertical"},h={type:"horizontal"};"slide"==this.mode&&(n=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,l=this.$el.clientHeight,s=this.$el.clientWidth),c.process=Math.min(n/(o-l),1),h.process=Math.min(a/(r-s),1),c.barSize=this.bar.vBar.state.size,h.barSize=this.bar.hBar.state.size,c.scrollTop=n,h.scrollLeft=a,this.$emit(e,c,h,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var e=this;this.destroyResize&&this.destroyResize();var t=null;"slide"==this.mode||"pure-native"==this.mode?t=this.scrollPanelElm:"native"==this.mode&&(t=this.scrollContentElm);var i=function(){e.updateBarStateAndEmitEvent(),e.showAndDefferedHideBar(),"slide"==e.mode&&e.updateScroller()};window.addEventListener("resize",i,!1);var o=listenResize(t,function(){var t={};"slide"==e.mode?(e.updateScroller(),t.width=e.scroller.__contentWidth,t.height=e.scroller.__contentHeight):"native"!=e.mode&&"pure-native"!=e.mode||(t.width=e.scrollPanelElm.scrollWidth,t.height=e.scrollPanelElm.scrollHeight),e.updateBarStateAndEmitEvent("handle-resize",t),e.showAndDefferedHideBar()});this.destroyResize=function(){window.removeEventListener("resize",i,!1),o()}},registryParentResize:function(){this.destroyParentDomResize=listenResize(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.clientHeight+"px",this.vuescroll.state.width=e.clientWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=findValuesByMode(e,this);this.vuescroll.state.internalScrollLeft=t.x,this.vuescroll.state.internalScrollTop=t.y},initWatch:function(){var e=this,t={deep:!0,sync:!0};this.$watch("mergedOptions",function(){e.recordCurrentPos(),e.$nextTick(function(){1!=e.isSmallChangeThisTick?(e.registryResize(),e.updateMode(),e.setVsSize()):e.isSmallChangeThisTick=!1})},t),smallChangeArray.forEach(function(i){e.$watch(i,function(){e.isSmallChangeThisTick=!0},t)})},scrollToHash:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||function(e){return/^#[a-zA-Z_]\d*$/.test(e)}(e))){var t=document.querySelector(e);!isChildInParent(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}}},mounted:function(){this.renderError||("slide"==this.mode&&(this.destroyScroller=this.registryScroller()),this.$el._isVuescroll=!0,this.lastMode=this.mode,this.registryResize(),this.initWatch(),this.setVsSize(),this.updateBarStateAndEmitEvent(),this.showAndDefferedHideBar(),this.scrollToHash())},updated:function(){var e=this;this.$nextTick(function(){e._isDestroyed||e.showAndDefferedHideBar()})},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)}},Vuescroll={install:function(e){e.component(vueScrollCore.name,vueScrollCore),e.prototype.$vuescrollConfig=deepMerge(GCF,{})},version:"4.5.18"};"undefined"!=typeof window&&window.Vue&&Vue.use(Vuescroll);export default Vuescroll; \ No newline at end of file +import Vue from"vue";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function deepCopy(e,t){for(var i in t="object"===(void 0===t?"undefined":_typeof(t))&&t||{},e)t[i]="object"===_typeof(e[i])?deepCopy(e[i],t[i]={}):e[i];return t}function deepMerge(e,t){for(var i in t=t||{},e)"object"===_typeof(e[i])?void 0===t[i]?(t[i]={},deepCopy(e[i],t[i])):deepMerge(e[i],t[i]):void 0===t[i]&&(t[i]=e[i]);return t}function defineReactive(e,t,i,o){var r=null;(i[t]||"function"==typeof i)&&(o=o||t,"function"==typeof i&&(r=i),Object.defineProperty(e,t,{get:r||function(){return i[o]},configurable:!0}))}var scrollBarWidth=void 0;function getGutter(){if(Vue.prototype.$isServer)return 0;if(void 0!==scrollBarWidth)return scrollBarWidth;var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var i=document.createElement("div");i.style.width="100%",e.appendChild(i);var o=i.offsetWidth;return e.parentNode.removeChild(e),scrollBarWidth=t-o}var doneUtil={refreshDomStyle:!1,loadDomStyle:!1,hide:!1};function hideSystemBar(){if(!doneUtil.hide){doneUtil.hide=!0;var e=document.createElement("style");e.type="text/css",e.innerHTML=".vuescroll-panel::-webkit-scrollbar{width:0;height:0}",document.getElementsByTagName("HEAD").item(0).appendChild(e)}}var styleMap={};function createDomStyle(e){if(!doneUtil[e]){doneUtil[e]=!0;var t=document.createElement("style");t.type="text/css",t.innerHTML=styleMap[e],document.getElementsByTagName("HEAD").item(0).appendChild(t)}}function eventCenter(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"on"==(arguments.length>4&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,i,o):e.removeEventListener(t,i,o)}styleMap.refreshDomStyle="\n.vuescroll-refresh {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-refresh svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-refresh svg path,\n.vuescroll-refresh svg rect{\nfill: #FF6700;\n}\n",styleMap.loadDomStyle="\n.vuescroll-load {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-load svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-load svg path,\n.vuescroll-load svg rect{\nfill: #FF6700;\n}\n";var log=console,error=void 0;function getScrollError(){if(Vue.prototype.$isServer)return 0;if(void 0!==error)return error;var e=document.createElement("div");e.style.visibility="hidden",e.style.height="100px",e.style.position="absolute",e.style.top="-9999px",e.style.overflow="hidden",document.body.appendChild(e);var t=document.createElement("div");return t.style.visibility="hidden",t.style.height="100px",t.style.display="inline-block",e.appendChild(t),error=e.scrollHeight-e.clientHeight,e.parentNode.removeChild(e),error}function isChildInParent(e,t){var i=!1;if(!e||!t)return i;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(i=!0),i}function listenResize(e,t){var i=document.createElement("object");return i.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i.tabIndex=-1,i.type="text/html",i.data="about:blank",i.isResizeElm=!0,i.onload=function(){eventCenter(i.contentDocument.defaultView,"resize",t)},e.appendChild(i),function(){i.contentDocument&&eventCenter(i.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i)}}var modes=["slide","native","pure-native"],NOOP=function(){},smallChangeArray=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],GCF={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{tag:"div",padding:!1,props:{},attrs:{}},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{vBar:{background:"#00a650",deltaY:100,keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};function validateOptions(e){var t=!1,i=e.vuescroll,o=e.scrollPanel;~modes.indexOf(i.mode)||(log.error('[vuescroll]: The vuescroll\'s option "mode" should be one of the '+modes),t=!0),i.paging==i.snapping.enable&&i.paging&&(i.pullRefresh||i.pushLoad)&&log.error("[vuescroll]: paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var r=o.initialScrollY,l=o.initialScrollX;return r&&!String(r).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&log.error("[vuescroll]: The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}function hackPropsData(){var e=this;if("vueScroll"===e.$options.name){var t=deepMerge(e.$vuescrollConfig,{}),i=deepMerge(GCF,t);e.$options.propsData.ops=e.$options.propsData.ops||{},Object.keys(e.$options.propsData.ops).forEach(function(t){defineReactive(e.mergedOptions,t,e.$options.propsData.ops)}),deepMerge(i,e.mergedOptions),defineReactive(e.mergedOptions.bar.vBar,"pos",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.vBar,"width",e.mergedOptions.rail.vRail),defineReactive(e.mergedOptions.bar.hBar,"pos",e.mergedOptions.rail.hRail),defineReactive(e.mergedOptions.bar.hBar,"height",e.mergedOptions.rail.hRail);defineReactive(e.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+e.mergedOptions.rail.vRail.pos}),defineReactive(e.mergedOptions.scrollContent,"paddValue",function(){return e.mergedOptions.rail.vRail.width})}}var hackLifecycle={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){hackPropsData.call(this),this.renderError=validateOptions(this.mergedOptions)}};function createEasingFunction(e,t){return function(i){return t(e,i)}}function easingPattern(e,t){var i=null;return"easeInQuad"===e&&(i=t*t),"easeOutQuad"===e&&(i=t*(2-t)),"easeInOutQuad"===e&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(i=t*t*t),"easeOutCubic"===e&&(i=--t*t*t+1),"easeInOutCubic"===e&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(i=t*t*t*t),"easeOutQuart"===e&&(i=1- --t*t*t*t),"easeInOutQuart"===e&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(i=t*t*t*t*t),"easeOutQuint"===e&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),i||t}function requestAnimationFrame(e){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,i=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(i=!1),i)return function(e,i){t(e,i)};var o={},r=1,l=null,s=+new Date;return function(e){var t=r++;return o[t]=e,requestCount++,null===l&&(l=setInterval(function(){var e=+new Date,t=o;for(var i in o={},requestCount=0,t)t.hasOwnProperty(i)&&(t[i](e),s=e);e-s>2500&&(clearInterval(l),l=null)},1e3/60)),t}}var time=Date.now||function(){return+new Date},desiredFrames=60,millisecondsPerSecond=1e3,running={},counter=1,core={effect:{}},global=null;function getNumericValue(e,t){var i=void 0;return i=(i=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(i=i[1]-0)/100:e-0}function goScrolling(e,t,i,o,r,l){var s=e.scrollTop,n=e.scrollLeft,a=n,c=s;s+i<0&&(i=-s);var h=getScrollError(),_=e.scrollHeight-h;s+i>_&&(i=_-s),n+t<0&&(t=-n),n+t>e.scrollWidth&&(t=e.scrollWidth-n);var d=createEasingFunction(r,easingPattern);core.effect.Animate.start(function(o){a=n+t*o,c=s+i*o,e.scrollTop=Math.floor(c),e.scrollLeft=Math.floor(a)},function(){return Math.abs(c-s)<=Math.abs(i)||Math.abs(a-n)<=Math.abs(t)},l,o,d)}global="undefined"!=typeof window?window:{},core.effect.Animate={requestAnimationFrame:requestAnimationFrame(global),stop:function(e){var t=null!=running[e];return t&&(running[e]=null),t},isRunning:function(e){return null!=running[e]},start:function(e,t,i,o,r,l){var s=time(),n=s,a=0,c=0,h=counter++;if(l||(l=document.body),h%20==0){var _={};for(var d in running)_[d]=!0;running=_}return running[h]=!0,core.effect.Animate.requestAnimationFrame(function _(d){var u=!0!==d,p=time();if(!running[h]||t&&!t(h))return running[h]=null,void(i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,!1));if(u)for(var f=Math.round((p-n)/(millisecondsPerSecond/desiredFrames))-1,m=0;m1&&(a=1);var v=r?r(a):a;!1!==e(v,p,u)&&1!==a||!u?u&&(n=p,core.effect.Animate.requestAnimationFrame(_,l)):(running[h]=null,i&&i(desiredFrames-c/((p-s)/millisecondsPerSecond),h,1===a||null==o))},l),h}};var api={methods:{scrollTo:function(e){var t=e.x,i=e.y,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=getScrollError();t=void 0===t?this.vuescroll.state.internalScrollLeft||0:getNumericValue(t,this.scrollPanelElm.scrollWidth),i=void 0===i?this.vuescroll.state.internalScrollTop||0:getNumericValue(i,this.scrollPanelElm.scrollHeight-l),this.internalScrollTo(t,i,o,r)},scrollBy:function(e){var t=e.dx,i=void 0===t?0:t,o=e.dy,r=void 0===o?0:o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=getScrollError(),n=this.vuescroll.state,a=n.internalScrollLeft,c=void 0===a?0:a,h=n.internalScrollTop,_=void 0===h?0:h;i&&(c+=getNumericValue(i,this.scrollPanelElm.scrollWidth)),r&&(_+=getNumericValue(r,this.scrollPanelElm.scrollHeight-s)),this.internalScrollTo(c,_,l)},zoomBy:function(e,t,i,o,r){"slide"==this.mode?this.scroller.zoomBy(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments[2],o=arguments[3],r=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,i,o,r):log.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):log.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},getCurrentviewDom:function(){for(var e=this,t=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,i=[],o=function(t){var i=t.getBoundingClientRect(),o=i.left,r=i.top,l=i.width,s=i.height,n=e.$el.getBoundingClientRect(),a=n.left,c=n.top,h=n.height,_=n.width;return o-a+l>0&&o-a<_&&r-c+s>0&&r-c1&&void 0!==arguments[1])||arguments[1],i=this.$el;if("string"==typeof e&&(e=i.querySelector(e)),isChildInParent(e,i)){var o=this.$el.getBoundingClientRect(),r=o.left,l=o.top,s=e.getBoundingClientRect(),n=r-s.left,a=l-s.top;this.scrollBy({dx:-n,dy:-a},t)}else log.warn("[vuescroll]: The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")}}},nativeMode={methods:{updateNativeModeBarState:function(){var e=getScrollError(),t=this.scrollPanelElm,i=this.$el,o=100*i.clientHeight/(t.scrollHeight-e),r=100*i.clientWidth/t.scrollWidth;this.bar.vBar.state.posValue=100*(t.scrollTop-e)/i.clientHeight,this.bar.hBar.state.posValue=100*t.scrollLeft/i.clientWidth,this.bar.vBar.state.size=o<100?o+"%":0,this.bar.hBar.state.size=r<100?r+"%":0}}},animatingMethod=null,noAnimatingMethod=null;function Scroller(e,t){for(var i in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:NOOP,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[i]=t[i];animatingMethod=createEasingFunction(this.options.animatingEasing,easingPattern),noAnimatingMethod=createEasingFunction(this.options.noAnimatingEasing,easingPattern)}var members={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,i,o){e===+e&&(this.__clientWidth=e),t===+t&&(this.__clientHeight=t),i===+i&&(this.__contentWidth=i),o===+o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__refreshHeight=e,this.__refreshActivate=i,this.__refreshBeforeDeactivate=l,this.__refreshDeactivate=o,this.__refreshStart=r},activatePushToLoad:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,r=t.startCallback,l=t.beforeDeactivateCallback;this.__loadHeight=e,this.__loadActivate=i,this.__loadBeforeDeactivate=l,this.__loadDeactivate=o,this.__loadStart=r},triggerRefreshOrLoad:function(){"refresh"==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"refresh")?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart())},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,i,o,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1);var l=this.__zoomLevel;null==i&&(i=this.__clientWidth/2),null==o&&(o=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);var s=(i+this.__scrollLeft)*e/l-i,n=(o+this.__scrollTop)*e/l-o;s>this.__maxScrollLeft?s=this.__maxScrollLeft:s<0&&(s=0),n>this.__maxScrollTop?n=this.__maxScrollTop:n<0&&(n=0),this.__publish(s,n,e,t)},zoomBy:function(e,t,i,o,r){this.zoomTo(this.__zoomLevel*e,t,i,o,r)},scrollTo:function(e,t,i,o,r){if(this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1),null!=o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=o,t*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX||r?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY||r?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(i=!1),this.__isTracking||this.__publish(e,t,o,i)},scrollBy:function(e,t,i){var o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(e||0),r+(t||0),i)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var i=e.x,o=e.y;isNaN(i)&&(i=1),isNaN(o)&&(o=1),this.scrollTo((i-1)*this.__clientWidth,(o-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,i,o){var r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,i-this.__clientLeft,o-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(core.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1,this.__interruptedAnimation=!0),this.__isAnimating&&(core.effect.Animate.stop(this.__isAnimating),this.__isAnimating=!1,this.__interruptedAnimation=!0);var r=1===e.length;r?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=i,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=i,this.__lastTouchTop=o,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]},doTouchMove:function(e,t,i){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){var o,r;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,r=e[0].pageY);var l=this.__positions;if(this.__isDragging){var s=o-this.__lastTouchLeft,n=r-this.__lastTouchTop,a=this.__scrollLeft,c=this.__scrollTop,h=this.__zoomLevel;if(null!=i&&this.options.zooming){var _=h;if(h=h/this.__lastScale*i,_!==(h=Math.max(Math.min(h,this.options.maxZoom),this.options.minZoom))){var d=o-this.__clientLeft,u=r-this.__clientTop;a=(d+a)*h/_-d,c=(u+c)*h/_-u,this.__computeScrollMax(h)}}if(this.__enableScrollX){a-=s*this.options.speedMultiplier;var p=this.__maxScrollLeft;(a>p||a<0)&&(this.options.bouncing?a+=s/2*this.options.speedMultiplier:a=a>p?p:0)}if(this.__enableScrollY){c-=n*this.options.speedMultiplier;var f=this.__maxScrollTop;(c>f||c<0)&&(this.options.bouncing?(c+=n/2*this.options.speedMultiplier,this.__enableScrollX||null==this.__refreshHeight&&null==this.__loadHeight||(!this.__refreshActive&&c<=-this.__refreshHeight?(this.__refreshActive=!0,this.__refreshActivate&&this.__refreshActivate()):this.__refreshActive&&c>-this.__refreshHeight?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):!this.__loadActive&&c>=this.__maxScrollTop+this.__loadHeight?(this.__loadActive=!0,this.__loadActivate&&this.__loadActivate()):this.__refreshActive&&cf?f:0)}l.length>60&&l.splice(0,30),l.push(a,c,t),this.__publish(a,c,h)}else{var m=this.options.locking?3:0,v=Math.abs(o-this.__initialTouchLeft),g=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&v>=m,this.__enableScrollY=this.options.scrollingY&&g>=m,l.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(v>=5||g>=5),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=i}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){for(var t=this.__positions,i=t.length-1,o=i,r=i;r>0&&t[r]>this.__lastTouchMove-100;r-=3)o=r;if(o!==i){var l=t[i]-t[o],s=this.__scrollLeft-t[o-2],n=this.__scrollTop-t[o-1];this.__decelerationVelocityX=s/l*(1e3/60),this.__decelerationVelocityY=n/l*(1e3/60);var a=this.options.paging||this.options.snapping?4:1;Math.abs(this.__decelerationVelocityX)>a||Math.abs(this.__decelerationVelocityY)>a?this.__refreshActive||this.__loadActive||this.__startDeceleration(e):this.__scrollComplete()}else this.__scrollComplete()}else e-this.__lastTouchMove>100&&this.__scrollComplete();this.__isDecelerating||(this.__refreshActive&&this.__refreshStart?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):this.__loadActive&&this.__loadStart?(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart()):((this.__interruptedAnimation||this.__isDragging)&&this.__scrollComplete(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel),this.__refreshActive?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):this.__loadActive&&(this.__loadActive=!1,this.__loadDeactivate&&this.__loadDeactivate()))),this.__positions.length=0}},onScroll:NOOP,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,i,o){var r=this;if(!r.__disable){!isNaN(e)&&e||(e=this.__scrollLeft),!isNaN(t)&&t||(t=this.__scrollTop);var l=r.__isAnimating;if(l&&(core.effect.Animate.stop(l),r.__isAnimating=!1),o&&r.options.animating){r.__scheduledLeft=e,r.__scheduledTop=t,r.__scheduledZoom=i;var s=r.__scrollLeft,n=r.__scrollTop,a=r.__zoomLevel,c=e-s,h=t-n,_=i-a;r.__isAnimating=core.effect.Animate.start(function(e,t,i){i&&(r.__scrollLeft=s+c*e,r.__scrollTop=n+h*e,r.__zoomLevel=a+_*e,r.__callback&&(r.__callback(r.__scrollLeft,r.__scrollTop,r.__zoomLevel),r.onScroll()))},function(e){return r.__isAnimating===e},function(e,t,i){t===r.__isAnimating&&(r.__isAnimating=!1),(r.__didDecelerationComplete||i)&&r.__scrollComplete(),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))},r.options.animationDuration,l?animatingMethod:noAnimatingMethod)}else r.__scheduledLeft=r.__scrollLeft=e,r.__scheduledTop=r.__scrollTop=t,r.__scheduledZoom=r.__zoomLevel=i,r.__callback&&(r.__callback(e,t,i),r.onScroll()),r.options.zooming&&(r.__computeScrollMax(),r.__zoomComplete&&(r.__zoomComplete(),r.__zoomComplete=null))}},__computeScrollMax:function(e){null==e&&(e=this.__zoomLevel),this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)},__computePage:function(){var e=this.__clientWidth,t=this.__clientHeight,i=this.__scrollLeft,o=this.__scrollTop;this.__totalXPage=Math.ceil(this.__contentWidth/e),this.__currentPageX=Math.ceil(i/e+1),this.__totalYPage=Math.ceil(this.__contentHeight/t),this.__currentPageY=Math.ceil(o/t+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),i=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),o=e.__clientWidth,r=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/o)*o,e.__minDecelerationScrollTop=Math.floor(i/r)*r,e.__maxDecelerationScrollLeft=Math.ceil(t/o)*o,e.__maxDecelerationScrollTop=Math.ceil(i/r)*r}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop;var l=e.options.snapping?4:.001;e.__isDecelerating=core.effect.Animate.start(function(t,i,o){e.__stepThroughDeceleration(o)},function(){var t=Math.abs(e.__decelerationVelocityX)>=l||Math.abs(e.__decelerationVelocityY)>=l;return t||(e.__didDecelerationComplete=!0),t},function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollComplete(),e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)})},__stepThroughDeceleration:function(e){var t=this.__scrollLeft+this.__decelerationVelocityX,i=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){var o=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);o!==t&&(t=o,this.__decelerationVelocityX=0);var r=Math.max(Math.min(this.__maxDecelerationScrollTop,i),this.__minDecelerationScrollTop);r!==i&&(i=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,i,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=i),!this.options.paging){this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95}if(this.options.bouncing){var l=0,s=0,n=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;tthis.__maxDecelerationScrollLeft&&(l=this.__maxDecelerationScrollLeft-t),ithis.__maxDecelerationScrollTop&&(s=this.__maxDecelerationScrollTop-i),0!==l&&(l*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=l*n:this.__decelerationVelocityX=l*a),0!==s&&(s*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=s*n:this.__decelerationVelocityY=s*a)}}};for(var key in members)Scroller.prototype[key]=members[key];function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function render(e,t,i,o){var r,l=document.documentElement.style,s=null,n=null;t.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?r="presto":"MozAppearance"in l?r="gecko":"WebkitAppearance"in l?r="webkit":"string"==typeof navigator.cpuClass&&(r="trident"),"string"==typeof e&&(n="vertical"==e?(s=0)||o:(s=o)&&0);var a={trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[r],c=document.createElement("div"),h=a+"Perspective";return void 0!==c.style[h]?"string"==typeof e?_defineProperty({},"transform","translate3d("+s+i+","+n+i+",0)"):function(t,o,r){e.style.transform="translate3d("+-t+i+","+-o+i+",0) scale("+r+")"}:void 0!==c.style.transform?"string"==typeof e?_defineProperty({},"transform","translate("+s+i+","+n+i+")"):function(t,o,r){e.style.transform="translate("+-t+i+","+-o+i+") scale("+r+")"}:void 0}function listenContainer(e,t,i,o,r){var l=null;function s(e){e.touches[0]&&e.touches[0].target&&e.touches[0].target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart(e.touches,e.timeStamp),r&&e.preventDefault(),document.addEventListener("touchmove",n,{passive:!1}))}function n(e){i("mousemove"),t.doTouchMove(e.touches,e.timeStamp,e.scale),e.preventDefault()}function a(e){i("mouseup"),t.doTouchEnd(e.timeStamp),document.removeEventListener("touchmove",n)}function c(e){t.doTouchEnd(e.timeStamp)}function h(e){e.target.tagName.match(/input|textarea|select/i)||(i("mousedown"),t.doTouchStart([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),r&&e.preventDefault(),p=!0)}function _(e){p&&(i("mousemove"),t.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),p=!0)}function d(e){p&&(i("mouseup"),t.doTouchEnd(e.timeStamp),p=!1)}function u(e){t.doMouseZoom(e.detail?-120*e.detail:e.wheelDelta,e.timeStamp,e.pageX,e.pageY)}if("ontouchstart"in window)e.addEventListener("touchstart",s,!1),document.addEventListener("touchend",a,!1),document.addEventListener("touchcancel",c,!1),l=function(){e.removeEventListener("touchstart",s,!1),document.removeEventListener("touchend",a,!1),document.removeEventListener("touchcancel",c,!1)};else{var p=!1;e.addEventListener("mousedown",h,!1),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",d,!1),o&&e.addEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1),l=function(){e.removeEventListener("mousedown",h,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",d,!1),e.removeEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",u,!1)}}return t.onScroll=function(){i("onscroll")},l}var _extends=Object.assign||function(e){for(var t=1;to.__maxScrollLeft&&(r=o.__scrollLeft-o.__maxScrollLeft)),_&&(o.__scrollTop<0?l=-o.__scrollTop:o.__scrollTop>o.__maxScrollTop&&(l=o.__scrollTop-o.__maxScrollTop)),e=100*n/(c+l),t=100*s/(a+r);var d=Math.min(Math.max(0,o.__scrollTop),o.__maxScrollTop),u=Math.min(Math.max(0,o.__scrollLeft),o.__maxScrollLeft);this.bar.vBar.state.posValue=100*(d+l)/i.clientHeight,this.bar.hBar.state.posValue=100*(u+r)/i.clientWidth,o.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),o.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t="refresh"==e?"refreshDom":"loadDom",i="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,o="refresh"==e?"refreshStage":"loadStage",r=this.$refs[t].elm||this.$refs[t],l=createStateCallbacks(e,o,this,r),s=r.offsetHeight;i.bind(this.scroller)(s,l)}}},map={vertical:{bar:{size:"height",opsSize:"width",posName:"top",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY"},axis:"Y"},horizontal:{bar:{size:"width",opsSize:"height",posName:"left",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX"},axis:"X"}},_extends$1=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null;"native"==this.mode||"pure-native"==this.mode?this.updateNativeModeBarState():"slide"==this.mode&&this.updateSlideModeBarState(),e&&this.emitEvent(e,t)},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e),this.showAndDefferedHideBar()},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.vuescroll.state.timeoutId&&clearTimeout(this.vuescroll.state.timeoutId),this.vuescroll.state.timeoutId=setTimeout(function(){e.vuescroll.state.timeoutId=0,e.hideBar()},500)},emitEvent:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.scrollPanelElm,o=i.scrollHeight,r=i.scrollWidth,l=i.clientHeight,s=i.clientWidth,n=i.scrollTop,a=i.scrollLeft,c={type:"vertical"},h={type:"horizontal"};"slide"==this.mode&&(n=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,l=this.$el.clientHeight,s=this.$el.clientWidth),c.process=Math.min(n/(o-l),1),h.process=Math.min(a/(r-s),1),c.barSize=this.bar.vBar.state.size,h.barSize=this.bar.hBar.state.size,c.scrollTop=n,h.scrollLeft=a,this.$emit(e,c,h,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var e=this;this.destroyResize&&this.destroyResize();var t=null;"slide"==this.mode||"pure-native"==this.mode?t=this.scrollPanelElm:"native"==this.mode&&(t=this.scrollContentElm);var i=function(){e.updateBarStateAndEmitEvent(),e.showAndDefferedHideBar(),"slide"==e.mode&&e.updateScroller()};window.addEventListener("resize",i,!1);var o=listenResize(t,function(){var t={};"slide"==e.mode?(e.updateScroller(),t.width=e.scroller.__contentWidth,t.height=e.scroller.__contentHeight):"native"!=e.mode&&"pure-native"!=e.mode||(t.width=e.scrollPanelElm.scrollWidth,t.height=e.scrollPanelElm.scrollHeight),e.updateBarStateAndEmitEvent("handle-resize",t),e.showAndDefferedHideBar()});this.destroyResize=function(){window.removeEventListener("resize",i,!1),o()}},registryParentResize:function(){this.destroyParentDomResize=listenResize(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.clientHeight+"px",this.vuescroll.state.width=e.clientWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=findValuesByMode(e,this);this.vuescroll.state.internalScrollLeft=t.x,this.vuescroll.state.internalScrollTop=t.y},initWatch:function(){var e=this,t={deep:!0,sync:!0};this.$watch("mergedOptions",function(){e.recordCurrentPos(),e.$nextTick(function(){1!=e.isSmallChangeThisTick?(e.registryResize(),e.updateMode(),e.setVsSize()):e.isSmallChangeThisTick=!1})},t),smallChangeArray.forEach(function(i){e.$watch(i,function(){e.isSmallChangeThisTick=!0},t)})},scrollToHash:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||function(e){return/^#[a-zA-Z_]\d*$/.test(e)}(e))){var t=document.querySelector(e);!isChildInParent(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}}},mounted:function(){this.renderError||("slide"==this.mode&&(this.destroyScroller=this.registryScroller()),this.$el._isVuescroll=!0,this.lastMode=this.mode,this.registryResize(),this.initWatch(),this.setVsSize(),this.updateBarStateAndEmitEvent(),this.showAndDefferedHideBar(),this.scrollToHash())},updated:function(){var e=this;this.$nextTick(function(){e._isDestroyed||e.showAndDefferedHideBar()})},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)}},Vuescroll={install:function(e){e.component(vueScrollCore.name,vueScrollCore),e.prototype.$vuescrollConfig=deepMerge(GCF,{})},version:"4.5.18"};"undefined"!=typeof window&&window.Vue&&Vue.use(Vuescroll);export default Vuescroll; \ No newline at end of file diff --git a/dist/vuescroll.js b/dist/vuescroll.js index 1c35b887..df3c8794 100644 --- a/dist/vuescroll.js +++ b/dist/vuescroll.js @@ -130,14 +130,14 @@ function eventCenter(dom, eventName, hander) { var log = console; var error = void 0; -// It only happens when child is inline-block, +// It only happens when child is inline-block in chrome, // scollheight will have a error of -// 4px in chrome or some other browsers. -// So write a method to get the error and get the real scrollHeight. -function getRealScrollHeight(scrollHeight) { +// 4px, so write a method to compute the error. +// https://stackoverflow.com/questions/29132892/how-to-auto-resize-an-input-field-vertically-and-not-horizontally-like-facebook/29133328#29133328 +function getScrollError() { /* istanbul ignore next */ if (Vue.prototype.$isServer) return 0; - if (error !== undefined) return scrollHeight - error; + if (error !== undefined) return error; var outer = document.createElement('div'); outer.style.visibility = 'hidden'; outer.style.height = '100px'; @@ -152,7 +152,7 @@ function getRealScrollHeight(scrollHeight) { outer.appendChild(inner); error = outer.scrollHeight - outer.clientHeight; outer.parentNode.removeChild(outer); - return scrollHeight - error; + return error; } function isChildInParent(child, parent) { @@ -677,7 +677,8 @@ function goScrolling(elm, deltaX, deltaY, speed, easing, scrollingComplete) { if (startLocationY + deltaY < 0) { deltaY = -startLocationY; } - var scrollHeight = getRealScrollHeight(elm['scrollHeight']); + var error = getScrollError(); + var scrollHeight = elm['scrollHeight'] - error; if (startLocationY + deltaY > scrollHeight) { deltaY = scrollHeight - startLocationY; } @@ -713,6 +714,7 @@ var api = { var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var error = getScrollError(); if (typeof x === 'undefined') { x = this.vuescroll.state.internalScrollLeft || 0; } else { @@ -721,7 +723,7 @@ var api = { if (typeof y === 'undefined') { y = this.vuescroll.state.internalScrollTop || 0; } else { - y = getNumericValue(y, getRealScrollHeight(this.scrollPanelElm.scrollHeight)); + y = getNumericValue(y, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(x, y, animate, force); }, @@ -731,6 +733,8 @@ var api = { _ref2$dy = _ref2.dy, dy = _ref2$dy === undefined ? 0 : _ref2$dy; var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var error = getScrollError(); var _vuescroll$state = this.vuescroll.state, _vuescroll$state$inte = _vuescroll$state.internalScrollLeft, internalScrollLeft = _vuescroll$state$inte === undefined ? 0 : _vuescroll$state$inte, @@ -741,7 +745,7 @@ var api = { internalScrollLeft += getNumericValue(dx, this.scrollPanelElm.scrollWidth); } if (dy) { - internalScrollTop += getNumericValue(dy, getRealScrollHeight(this.scrollPanelElm.scrollHeight)); + internalScrollTop += getNumericValue(dy, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(internalScrollLeft, internalScrollTop, animate); }, @@ -873,11 +877,12 @@ var api = { var nativeMode = { methods: { updateNativeModeBarState: function updateNativeModeBarState() { + var error = getScrollError(); var scrollPanel = this.scrollPanelElm; var vuescroll = this.$el; - var heightPercentage = vuescroll.clientHeight * 100 / getRealScrollHeight(scrollPanel.scrollHeight); + var heightPercentage = vuescroll.clientHeight * 100 / (scrollPanel.scrollHeight - error); var widthPercentage = vuescroll.clientWidth * 100 / scrollPanel.scrollWidth; - this.bar.vBar.state.posValue = scrollPanel.scrollTop * 100 / vuescroll.clientHeight; + this.bar.vBar.state.posValue = (scrollPanel.scrollTop - error) * 100 / vuescroll.clientHeight; this.bar.hBar.state.posValue = scrollPanel.scrollLeft * 100 / vuescroll.clientWidth; this.bar.vBar.state.size = heightPercentage < 100 ? heightPercentage + '%' : 0; this.bar.hBar.state.size = widthPercentage < 100 ? widthPercentage + '%' : 0; @@ -2850,6 +2855,7 @@ var scrollContent = { slots = _ref.slots; var style = deepMerge(props.state.style, {}); + var error = getScrollError(); style.position = 'relative'; style.minHeight = '100%'; style.minWidth = '100%'; @@ -2858,6 +2864,9 @@ var scrollContent = { if (props.ops.padding) { style[props.ops.paddPos] = props.ops.paddValue; } + if (error) { + style.marginBottom = '-' + error + 'px'; + } return h(props.ops.tag, { style: style, ref: 'scrollContent', diff --git a/dist/vuescroll.min.js b/dist/vuescroll.min.js index e4e7a6c2..c65b9d8b 100644 --- a/dist/vuescroll.min.js +++ b/dist/vuescroll.min.js @@ -5,4 +5,4 @@ * @license: MIT * @GitHub: https://github.com/wangyi7099/vuescroll */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):e.vuescroll=t(e.Vue)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,o){for(var s in o="object"===(void 0===o?"undefined":t(o))&&o||{},e)o[s]="object"===t(e[s])?i(e[s],o[s]={}):e[s];return o}function o(e,s){for(var l in s=s||{},e)"object"===t(e[l])?void 0===s[l]?(s[l]={},i(e[l],s[l])):o(e[l],s[l]):void 0===s[l]&&(s[l]=e[l]);return s}function s(e,t,i,o){var s=null;(i[t]||"function"==typeof i)&&(o=o||t,"function"==typeof i&&(s=i),Object.defineProperty(e,t,{get:s||function(){return i[o]},configurable:!0}))}var l=void 0;var r={refreshDomStyle:!1,loadDomStyle:!1,hide:!1};var n={};function a(e){if(!r[e]){r[e]=!0;var t=document.createElement("style");t.type="text/css",t.innerHTML=n[e],document.getElementsByTagName("HEAD").item(0).appendChild(t)}}function c(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"on"==(arguments.length>4&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,i,o):e.removeEventListener(t,i,o)}n.refreshDomStyle="\n.vuescroll-refresh {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-refresh svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-refresh svg path,\n.vuescroll-refresh svg rect{\nfill: #FF6700;\n}\n",n.loadDomStyle="\n.vuescroll-load {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-load svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-load svg path,\n.vuescroll-load svg rect{\nfill: #FF6700;\n}\n";var h=console,_=void 0;function u(t){if(e.prototype.$isServer)return 0;if(void 0!==_)return t-_;var i=document.createElement("div");i.style.visibility="hidden",i.style.height="100px",i.style.position="absolute",i.style.top="-9999px",i.style.overflow="hidden",document.body.appendChild(i);var o=document.createElement("div");return o.style.visibility="hidden",o.style.height="100px",o.style.display="inline-block",i.appendChild(o),_=i.scrollHeight-i.clientHeight,i.parentNode.removeChild(i),t-_}function d(e,t){var i=!1;if(!e||!t)return i;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(i=!0),i}function p(e,t){var i=document.createElement("object");return i.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i.tabIndex=-1,i.type="text/html",i.data="about:blank",i.isResizeElm=!0,i.onload=function(){c(i.contentDocument.defaultView,"resize",t)},e.appendChild(i),function(){i.contentDocument&&c(i.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i)}}var f=["slide","native","pure-native"],m=function(){},v=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],g={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{tag:"div",padding:!1,props:{},attrs:{}},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{vBar:{background:"#00a650",deltaY:100,keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};var b={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){(function(){var e=this;if("vueScroll"===e.$options.name){var t=o(e.$vuescrollConfig,{}),i=o(g,t);e.$options.propsData.ops=e.$options.propsData.ops||{},Object.keys(e.$options.propsData.ops).forEach(function(t){s(e.mergedOptions,t,e.$options.propsData.ops)}),o(i,e.mergedOptions),s(e.mergedOptions.bar.vBar,"pos",e.mergedOptions.rail.vRail),s(e.mergedOptions.bar.vBar,"width",e.mergedOptions.rail.vRail),s(e.mergedOptions.bar.hBar,"pos",e.mergedOptions.rail.hRail),s(e.mergedOptions.bar.hBar,"height",e.mergedOptions.rail.hRail),s(e.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+e.mergedOptions.rail.vRail.pos}),s(e.mergedOptions.scrollContent,"paddValue",function(){return e.mergedOptions.rail.vRail.width})}}).call(this),this.renderError=function(e){var t=!1,i=e.vuescroll,o=e.scrollPanel;~f.indexOf(i.mode)||(h.error('[vuescroll]: The vuescroll\'s option "mode" should be one of the '+f),t=!0),i.paging==i.snapping.enable&&i.paging&&(i.pullRefresh||i.pushLoad)&&h.error("[vuescroll]: paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var s=o.initialScrollY,l=o.initialScrollX;return s&&!String(s).match(/^\d+(\.\d+)?(%)?$/)&&h.error("[vuescroll]: The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&h.error("[vuescroll]: The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}(this.mergedOptions)}};function y(e,t){return function(i){return t(e,i)}}function S(e,t){var i=null;return"easeInQuad"===e&&(i=t*t),"easeOutQuad"===e&&(i=t*(2-t)),"easeInOutQuad"===e&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(i=t*t*t),"easeOutCubic"===e&&(i=--t*t*t+1),"easeInOutCubic"===e&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(i=t*t*t*t),"easeOutQuart"===e&&(i=1- --t*t*t*t),"easeInOutQuart"===e&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(i=t*t*t*t*t),"easeOutQuint"===e&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),i||t}var T=Date.now||function(){return+new Date},L={},x=1,w={effect:{}},D=null;function z(e,t){var i=void 0;return i=(i=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(i=i[1]-0)/100:e-0}D="undefined"!=typeof window?window:{},w.effect.Animate={requestAnimationFrame:function(e){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,i=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(i=!1),i)return function(e,i){t(e,i)};var o={},s=1,l=null,r=+new Date;return function(e){var t=s++;return o[t]=e,requestCount++,null===l&&(l=setInterval(function(){var e=+new Date,t=o;for(var i in o={},requestCount=0,t)t.hasOwnProperty(i)&&(t[i](e),r=e);e-r>2500&&(clearInterval(l),l=null)},1e3/60)),t}}(D),stop:function(e){var t=null!=L[e];return t&&(L[e]=null),t},isRunning:function(e){return null!=L[e]},start:function(e,t,i,o,s,l){var r=T(),n=r,a=0,c=0,h=x++;if(l||(l=document.body),h%20==0){var _={};for(var u in L)_[u]=!0;L=_}return L[h]=!0,w.effect.Animate.requestAnimationFrame(function _(u){var d=!0!==u,p=T();if(!L[h]||t&&!t(h))return L[h]=null,void(i&&i(60-c/((p-r)/1e3),h,!1));if(d)for(var f=Math.round((p-n)/(1e3/60))-1,m=0;m1&&(a=1);var v=s?s(a):a;!1!==e(v,p,d)&&1!==a||!d?d&&(n=p,w.effect.Animate.requestAnimationFrame(_,l)):(L[h]=null,i&&i(60-c/((p-r)/1e3),h,1===a||null==o))},l),h}};var O={methods:{scrollTo:function(e){var t=e.x,i=e.y,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=void 0===t?this.vuescroll.state.internalScrollLeft||0:z(t,this.scrollPanelElm.scrollWidth),i=void 0===i?this.vuescroll.state.internalScrollTop||0:z(i,u(this.scrollPanelElm.scrollHeight)),this.internalScrollTo(t,i,o,s)},scrollBy:function(e){var t=e.dx,i=void 0===t?0:t,o=e.dy,s=void 0===o?0:o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.vuescroll.state,n=r.internalScrollLeft,a=void 0===n?0:n,c=r.internalScrollTop,h=void 0===c?0:c;i&&(a+=z(i,this.scrollPanelElm.scrollWidth)),s&&(h+=z(s,u(this.scrollPanelElm.scrollHeight))),this.internalScrollTo(a,h,l)},zoomBy:function(e,t,i,o,s){"slide"==this.mode?this.scroller.zoomBy(e,t,i,o,s):h.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments[2],o=arguments[3],s=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,i,o,s):h.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();h.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):h.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},getCurrentviewDom:function(){for(var e=this,t=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,i=[],o=function(t){var i=t.getBoundingClientRect(),o=i.left,s=i.top,l=i.width,r=i.height,n=e.$el.getBoundingClientRect(),a=n.left,c=n.top,h=n.height,_=n.width;return o-a+l>0&&o-a<_&&s-c+r>0&&s-ch&&(i=h-r),n+t<0&&(t=-n),n+t>e.scrollWidth&&(t=e.scrollWidth-n);var _=y(s,S);w.effect.Animate.start(function(o){a=n+t*o,c=r+i*o,e.scrollTop=Math.floor(c),e.scrollLeft=Math.floor(a)},function(){return Math.abs(c-r)<=Math.abs(i)||Math.abs(a-n)<=Math.abs(t)},l,o,_)}(this.$refs.scrollPanel.$el,e-this.$refs.scrollPanel.$el.scrollLeft,t-this.$refs.scrollPanel.$el.scrollTop,this.mergedOptions.scrollPanel.speed,this.mergedOptions.scrollPanel.easing,function(){s.updateBarStateAndEmitEvent("handle-scroll-complete")})}else this.$refs.scrollPanel.$el.scrollTop=t,this.$refs.scrollPanel.$el.scrollLeft=e;else"slide"==this.mode&&this.scroller.scrollTo(e,t,i,void 0,o)},scrollIntoView:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.$el;if("string"==typeof e&&(e=i.querySelector(e)),d(e,i)){var o=this.$el.getBoundingClientRect(),s=o.left,l=o.top,r=e.getBoundingClientRect(),n=s-r.left,a=l-r.top;this.scrollBy({dx:-n,dy:-a},t)}else h.warn("[vuescroll]: The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")}}},P={methods:{updateNativeModeBarState:function(){var e=this.scrollPanelElm,t=this.$el,i=100*t.clientHeight/u(e.scrollHeight),o=100*t.clientWidth/e.scrollWidth;this.bar.vBar.state.posValue=100*e.scrollTop/t.clientHeight,this.bar.hBar.state.posValue=100*e.scrollLeft/t.clientWidth,this.bar.vBar.state.size=i<100?i+"%":0,this.bar.hBar.state.size=o<100?o+"%":0}}},M=null,C=null;function B(e,t){for(var i in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:m,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[i]=t[i];M=y(this.options.animatingEasing,S),C=y(this.options.noAnimatingEasing,S)}var A={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,i,o){e===+e&&(this.__clientWidth=e),t===+t&&(this.__clientHeight=t),i===+i&&(this.__contentWidth=i),o===+o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,s=t.startCallback,l=t.beforeDeactivateCallback;this.__refreshHeight=e,this.__refreshActivate=i,this.__refreshBeforeDeactivate=l,this.__refreshDeactivate=o,this.__refreshStart=s},activatePushToLoad:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,s=t.startCallback,l=t.beforeDeactivateCallback;this.__loadHeight=e,this.__loadActivate=i,this.__loadBeforeDeactivate=l,this.__loadDeactivate=o,this.__loadStart=s},triggerRefreshOrLoad:function(){"refresh"==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"refresh")?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart())},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,i,o,s){if(!this.options.zooming)throw new Error("Zooming is not enabled!");s&&(this.__zoomComplete=s),this.__isDecelerating&&(w.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1);var l=this.__zoomLevel;null==i&&(i=this.__clientWidth/2),null==o&&(o=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);var r=(i+this.__scrollLeft)*e/l-i,n=(o+this.__scrollTop)*e/l-o;r>this.__maxScrollLeft?r=this.__maxScrollLeft:r<0&&(r=0),n>this.__maxScrollTop?n=this.__maxScrollTop:n<0&&(n=0),this.__publish(r,n,e,t)},zoomBy:function(e,t,i,o,s){this.zoomTo(this.__zoomLevel*e,t,i,o,s)},scrollTo:function(e,t,i,o,s){if(this.__isDecelerating&&(w.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1),null!=o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=o,t*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX||s?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY||s?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(i=!1),this.__isTracking||this.__publish(e,t,o,i)},scrollBy:function(e,t,i){var o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,s=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(e||0),s+(t||0),i)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var i=e.x,o=e.y;isNaN(i)&&(i=1),isNaN(o)&&(o=1),this.scrollTo((i-1)*this.__clientWidth,(o-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,i,o){var s=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*s,!1,i-this.__clientLeft,o-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(w.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1,this.__interruptedAnimation=!0),this.__isAnimating&&(w.effect.Animate.stop(this.__isAnimating),this.__isAnimating=!1,this.__interruptedAnimation=!0);var s=1===e.length;s?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=i,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=i,this.__lastTouchTop=o,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!s&&this.options.scrollingX,this.__enableScrollY=!s&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!s,this.__isSingleTouch=s,this.__positions=[]},doTouchMove:function(e,t,i){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){var o,s;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,s=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,s=e[0].pageY);var l=this.__positions;if(this.__isDragging){var r=o-this.__lastTouchLeft,n=s-this.__lastTouchTop,a=this.__scrollLeft,c=this.__scrollTop,h=this.__zoomLevel;if(null!=i&&this.options.zooming){var _=h;if(h=h/this.__lastScale*i,_!==(h=Math.max(Math.min(h,this.options.maxZoom),this.options.minZoom))){var u=o-this.__clientLeft,d=s-this.__clientTop;a=(u+a)*h/_-u,c=(d+c)*h/_-d,this.__computeScrollMax(h)}}if(this.__enableScrollX){a-=r*this.options.speedMultiplier;var p=this.__maxScrollLeft;(a>p||a<0)&&(this.options.bouncing?a+=r/2*this.options.speedMultiplier:a=a>p?p:0)}if(this.__enableScrollY){c-=n*this.options.speedMultiplier;var f=this.__maxScrollTop;(c>f||c<0)&&(this.options.bouncing?(c+=n/2*this.options.speedMultiplier,this.__enableScrollX||null==this.__refreshHeight&&null==this.__loadHeight||(!this.__refreshActive&&c<=-this.__refreshHeight?(this.__refreshActive=!0,this.__refreshActivate&&this.__refreshActivate()):this.__refreshActive&&c>-this.__refreshHeight?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):!this.__loadActive&&c>=this.__maxScrollTop+this.__loadHeight?(this.__loadActive=!0,this.__loadActivate&&this.__loadActivate()):this.__refreshActive&&cf?f:0)}l.length>60&&l.splice(0,30),l.push(a,c,t),this.__publish(a,c,h)}else{var m=this.options.locking?3:0,v=Math.abs(o-this.__initialTouchLeft),g=Math.abs(s-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&v>=m,this.__enableScrollY=this.options.scrollingY&&g>=m,l.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(v>=5||g>=5),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=s,this.__lastTouchMove=t,this.__lastScale=i}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){for(var t=this.__positions,i=t.length-1,o=i,s=i;s>0&&t[s]>this.__lastTouchMove-100;s-=3)o=s;if(o!==i){var l=t[i]-t[o],r=this.__scrollLeft-t[o-2],n=this.__scrollTop-t[o-1];this.__decelerationVelocityX=r/l*(1e3/60),this.__decelerationVelocityY=n/l*(1e3/60);var a=this.options.paging||this.options.snapping?4:1;Math.abs(this.__decelerationVelocityX)>a||Math.abs(this.__decelerationVelocityY)>a?this.__refreshActive||this.__loadActive||this.__startDeceleration(e):this.__scrollComplete()}else this.__scrollComplete()}else e-this.__lastTouchMove>100&&this.__scrollComplete();this.__isDecelerating||(this.__refreshActive&&this.__refreshStart?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):this.__loadActive&&this.__loadStart?(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart()):((this.__interruptedAnimation||this.__isDragging)&&this.__scrollComplete(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel),this.__refreshActive?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):this.__loadActive&&(this.__loadActive=!1,this.__loadDeactivate&&this.__loadDeactivate()))),this.__positions.length=0}},onScroll:m,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,i,o){var s=this;if(!s.__disable){!isNaN(e)&&e||(e=this.__scrollLeft),!isNaN(t)&&t||(t=this.__scrollTop);var l=s.__isAnimating;if(l&&(w.effect.Animate.stop(l),s.__isAnimating=!1),o&&s.options.animating){s.__scheduledLeft=e,s.__scheduledTop=t,s.__scheduledZoom=i;var r=s.__scrollLeft,n=s.__scrollTop,a=s.__zoomLevel,c=e-r,h=t-n,_=i-a;s.__isAnimating=w.effect.Animate.start(function(e,t,i){i&&(s.__scrollLeft=r+c*e,s.__scrollTop=n+h*e,s.__zoomLevel=a+_*e,s.__callback&&(s.__callback(s.__scrollLeft,s.__scrollTop,s.__zoomLevel),s.onScroll()))},function(e){return s.__isAnimating===e},function(e,t,i){t===s.__isAnimating&&(s.__isAnimating=!1),(s.__didDecelerationComplete||i)&&s.__scrollComplete(),s.options.zooming&&(s.__computeScrollMax(),s.__zoomComplete&&(s.__zoomComplete(),s.__zoomComplete=null))},s.options.animationDuration,l?M:C)}else s.__scheduledLeft=s.__scrollLeft=e,s.__scheduledTop=s.__scrollTop=t,s.__scheduledZoom=s.__zoomLevel=i,s.__callback&&(s.__callback(e,t,i),s.onScroll()),s.options.zooming&&(s.__computeScrollMax(),s.__zoomComplete&&(s.__zoomComplete(),s.__zoomComplete=null))}},__computeScrollMax:function(e){null==e&&(e=this.__zoomLevel),this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)},__computePage:function(){var e=this.__clientWidth,t=this.__clientHeight,i=this.__scrollLeft,o=this.__scrollTop;this.__totalXPage=Math.ceil(this.__contentWidth/e),this.__currentPageX=Math.ceil(i/e+1),this.__totalYPage=Math.ceil(this.__contentHeight/t),this.__currentPageY=Math.ceil(o/t+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),i=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),o=e.__clientWidth,s=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/o)*o,e.__minDecelerationScrollTop=Math.floor(i/s)*s,e.__maxDecelerationScrollLeft=Math.ceil(t/o)*o,e.__maxDecelerationScrollTop=Math.ceil(i/s)*s}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop;var l=e.options.snapping?4:.001;e.__isDecelerating=w.effect.Animate.start(function(t,i,o){e.__stepThroughDeceleration(o)},function(){var t=Math.abs(e.__decelerationVelocityX)>=l||Math.abs(e.__decelerationVelocityY)>=l;return t||(e.__didDecelerationComplete=!0),t},function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollComplete(),e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)})},__stepThroughDeceleration:function(e){var t=this.__scrollLeft+this.__decelerationVelocityX,i=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){var o=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);o!==t&&(t=o,this.__decelerationVelocityX=0);var s=Math.max(Math.min(this.__maxDecelerationScrollTop,i),this.__minDecelerationScrollTop);s!==i&&(i=s,this.__decelerationVelocityY=0)}if(e?this.__publish(t,i,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=i),!this.options.paging){this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95}if(this.options.bouncing){var l=0,r=0,n=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;tthis.__maxDecelerationScrollLeft&&(l=this.__maxDecelerationScrollLeft-t),ithis.__maxDecelerationScrollTop&&(r=this.__maxDecelerationScrollTop-i),0!==l&&(l*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=l*n:this.__decelerationVelocityX=l*a),0!==r&&(r*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=r*n:this.__decelerationVelocityY=r*a)}}};for(var E in A)B.prototype[E]=A[E];function k(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function $(e,t,i,o){var s,l=document.documentElement.style,r=null,n=null;t.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?s="presto":"MozAppearance"in l?s="gecko":"WebkitAppearance"in l?s="webkit":"string"==typeof navigator.cpuClass&&(s="trident"),"string"==typeof e&&(n="vertical"==e?(r=0)||o:(r=o)&&0);var a={trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[s],c=document.createElement("div"),h=a+"Perspective";return void 0!==c.style[h]?"string"==typeof e?k({},"transform","translate3d("+r+i+","+n+i+",0)"):function(t,o,s){e.style.transform="translate3d("+-t+i+","+-o+i+",0) scale("+s+")"}:void 0!==c.style.transform?"string"==typeof e?k({},"transform","translate("+r+i+","+n+i+")"):function(t,o,s){e.style.transform="translate("+-t+i+","+-o+i+") scale("+s+")"}:void 0}var R=Object.assign||function(e){for(var t=1;t-1?"DOMMouseScroll":"mousewheel",d,!1),l=function(){e.removeEventListener("mousedown",h,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",u,!1),e.removeEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",d,!1)}}return t.onScroll=function(){i("onscroll")},l}(this.$el,this.scroller,function(t){switch(t){case"mousedown":e.vuescroll.state.isDragging=!0;break;case"onscroll":e.handleScroll(!1);break;case"mouseup":e.vuescroll.state.isDragging=!1}},s,t);return this.mergedOptions.vuescroll.pullRefresh.enable&&this.registryEvent("refresh"),this.mergedOptions.vuescroll.pushLoad.enable&&this.registryEvent("load"),this.updateScroller(),c},updateSlideModeBarState:function(){var e,t,i=this.$el,o=this.scroller,s=0,l=0,r=i.clientWidth,n=i.clientHeight,a=r+this.scroller.__maxScrollLeft,c=n+this.scroller.__maxScrollTop,h=ro.__maxScrollLeft&&(s=o.__scrollLeft-o.__maxScrollLeft)),_&&(o.__scrollTop<0?l=-o.__scrollTop:o.__scrollTop>o.__maxScrollTop&&(l=o.__scrollTop-o.__maxScrollTop)),e=100*n/(c+l),t=100*r/(a+s);var u=Math.min(Math.max(0,o.__scrollTop),o.__maxScrollTop),d=Math.min(Math.max(0,o.__scrollLeft),o.__maxScrollLeft);this.bar.vBar.state.posValue=100*(u+l)/i.clientHeight,this.bar.hBar.state.posValue=100*(d+s)/i.clientWidth,o.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),o.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t="refresh"==e?"refreshDom":"loadDom",i="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,o="refresh"==e?"refreshStage":"loadStage",s=this.$refs[t].elm||this.$refs[t],l=function(e,t,i,o){var s=i.$listeners,l=function(){i.vuescroll.state[t]="active"},r=function(){i.vuescroll.state[t]="deactive"},n=function(){i.vuescroll.state[t]="start",setTimeout(function(){i.scroller.finishRefreshOrLoad()},2e3)},a=function(e){i.vuescroll.state[t]="beforeDeactive",setTimeout(function(){e()},500)};return s[e+"-activate"]&&(l=function(){i.vuescroll.state[t]="active",i.$emit(e+"-activate",i,o)}),s[e+"-before-deactivate"]&&(a=function(s){i.vuescroll.state[t]="beforeDeactive",i.$emit(e+"-before-deactivate",i,o,s.bind(i.scroller))}),s[e+"-deactivate"]&&(r=function(){i.vuescroll.state[t]="deactive",i.$emit(e+"-deactivate",i,o)}),s[e+"-start"]&&(n=function(){i.vuescroll.state[t]="start",i.$emit(e+"-start",i,o,i.scroller.finishRefreshOrLoad.bind(i.scroller))}),{activateCallback:l,deactivateCallback:r,startCallback:n,beforeDeactivateCallback:a}}(e,o,this,s),r=s.offsetHeight;i.bind(this.scroller)(r,l)}}},X={vertical:{bar:{size:"height",opsSize:"width",posName:"top",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY"},axis:"Y"},horizontal:{bar:{size:"width",opsSize:"height",posName:"left",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX"},axis:"X"}},Y=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null;"native"==this.mode||"pure-native"==this.mode?this.updateNativeModeBarState():"slide"==this.mode&&this.updateSlideModeBarState(),e&&this.emitEvent(e,t)},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e),this.showAndDefferedHideBar()},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.vuescroll.state.timeoutId&&clearTimeout(this.vuescroll.state.timeoutId),this.vuescroll.state.timeoutId=setTimeout(function(){e.vuescroll.state.timeoutId=0,e.hideBar()},500)},emitEvent:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.scrollPanelElm,o=i.scrollHeight,s=i.scrollWidth,l=i.clientHeight,r=i.clientWidth,n=i.scrollTop,a=i.scrollLeft,c={type:"vertical"},h={type:"horizontal"};"slide"==this.mode&&(n=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,l=this.$el.clientHeight,r=this.$el.clientWidth),c.process=Math.min(n/(o-l),1),h.process=Math.min(a/(s-r),1),c.barSize=this.bar.vBar.state.size,h.barSize=this.bar.hBar.state.size,c.scrollTop=n,h.scrollLeft=a,this.$emit(e,c,h,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var e=this;this.destroyResize&&this.destroyResize();var t=null;"slide"==this.mode||"pure-native"==this.mode?t=this.scrollPanelElm:"native"==this.mode&&(t=this.scrollContentElm);var i=function(){e.updateBarStateAndEmitEvent(),e.showAndDefferedHideBar(),"slide"==e.mode&&e.updateScroller()};window.addEventListener("resize",i,!1);var o=p(t,function(){var t={};"slide"==e.mode?(e.updateScroller(),t.width=e.scroller.__contentWidth,t.height=e.scroller.__contentHeight):"native"!=e.mode&&"pure-native"!=e.mode||(t.width=e.scrollPanelElm.scrollWidth,t.height=e.scrollPanelElm.scrollHeight),e.updateBarStateAndEmitEvent("handle-resize",t),e.showAndDefferedHideBar()});this.destroyResize=function(){window.removeEventListener("resize",i,!1),o()}},registryParentResize:function(){this.destroyParentDomResize=p(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.clientHeight+"px",this.vuescroll.state.width=e.clientWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=function(e,t){var i={};switch(e){case"native":case"pure-native":i={x:t.scrollPanelElm.scrollLeft,y:t.scrollPanelElm.scrollTop};break;case"slide":i={x:t.scroller.__scrollLeft,y:t.scroller.__scrollTop}}return i}(e,this);this.vuescroll.state.internalScrollLeft=t.x,this.vuescroll.state.internalScrollTop=t.y},initWatch:function(){var e=this,t={deep:!0,sync:!0};this.$watch("mergedOptions",function(){e.recordCurrentPos(),e.$nextTick(function(){1!=e.isSmallChangeThisTick?(e.registryResize(),e.updateMode(),e.setVsSize()):e.isSmallChangeThisTick=!1})},t),v.forEach(function(i){e.$watch(i,function(){e.isSmallChangeThisTick=!0},t)})},scrollToHash:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||function(e){return/^#[a-zA-Z_]\d*$/.test(e)}(e))){var t=document.querySelector(e);!d(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}}},mounted:function(){this.renderError||("slide"==this.mode&&(this.destroyScroller=this.registryScroller()),this.$el._isVuescroll=!0,this.lastMode=this.mode,this.registryResize(),this.initWatch(),this.setVsSize(),this.updateBarStateAndEmitEvent(),this.showAndDefferedHideBar(),this.scrollToHash())},updated:function(){var e=this;this.$nextTick(function(){e._isDestroyed||e.showAndDefferedHideBar()})},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)}},F={install:function(e){e.component(Z.name,Z),e.prototype.$vuescrollConfig=o(g,{})},version:"4.5.18"};return"undefined"!=typeof window&&window.Vue&&e.use(F),F}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):e.vuescroll=t(e.Vue)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,o){for(var s in o="object"===(void 0===o?"undefined":t(o))&&o||{},e)o[s]="object"===t(e[s])?i(e[s],o[s]={}):e[s];return o}function o(e,s){for(var l in s=s||{},e)"object"===t(e[l])?void 0===s[l]?(s[l]={},i(e[l],s[l])):o(e[l],s[l]):void 0===s[l]&&(s[l]=e[l]);return s}function s(e,t,i,o){var s=null;(i[t]||"function"==typeof i)&&(o=o||t,"function"==typeof i&&(s=i),Object.defineProperty(e,t,{get:s||function(){return i[o]},configurable:!0}))}var l=void 0;var r={refreshDomStyle:!1,loadDomStyle:!1,hide:!1};var n={};function a(e){if(!r[e]){r[e]=!0;var t=document.createElement("style");t.type="text/css",t.innerHTML=n[e],document.getElementsByTagName("HEAD").item(0).appendChild(t)}}function c(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"on"==(arguments.length>4&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,i,o):e.removeEventListener(t,i,o)}n.refreshDomStyle="\n.vuescroll-refresh {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-refresh svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-refresh svg path,\n.vuescroll-refresh svg rect{\nfill: #FF6700;\n}\n",n.loadDomStyle="\n.vuescroll-load {\n position:absolute;\n width: 100%;\n color: black;\n height: 50px;\n text-align: center;\n font-size: 16px;\n line-height: 50px;\n}\n.vuescroll-load svg {\n margin-right: 10px;\n width: 25px;\n height: 25px;\n vertical-align: sub;\n}\n.vuescroll-load svg path,\n.vuescroll-load svg rect{\nfill: #FF6700;\n}\n";var h=console,_=void 0;function u(){if(e.prototype.$isServer)return 0;if(void 0!==_)return _;var t=document.createElement("div");t.style.visibility="hidden",t.style.height="100px",t.style.position="absolute",t.style.top="-9999px",t.style.overflow="hidden",document.body.appendChild(t);var i=document.createElement("div");return i.style.visibility="hidden",i.style.height="100px",i.style.display="inline-block",t.appendChild(i),_=t.scrollHeight-t.clientHeight,t.parentNode.removeChild(t),_}function d(e,t){var i=!1;if(!e||!t)return i;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(i=!0),i}function p(e,t){var i=document.createElement("object");return i.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i.tabIndex=-1,i.type="text/html",i.data="about:blank",i.isResizeElm=!0,i.onload=function(){c(i.contentDocument.defaultView,"resize",t)},e.appendChild(i),function(){i.contentDocument&&c(i.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i)}}var f=["slide","native","pure-native"],m=function(){},v=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],g={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{tag:"div",padding:!1,props:{},attrs:{}},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{vBar:{background:"#00a650",deltaY:100,keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};var b={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){(function(){var e=this;if("vueScroll"===e.$options.name){var t=o(e.$vuescrollConfig,{}),i=o(g,t);e.$options.propsData.ops=e.$options.propsData.ops||{},Object.keys(e.$options.propsData.ops).forEach(function(t){s(e.mergedOptions,t,e.$options.propsData.ops)}),o(i,e.mergedOptions),s(e.mergedOptions.bar.vBar,"pos",e.mergedOptions.rail.vRail),s(e.mergedOptions.bar.vBar,"width",e.mergedOptions.rail.vRail),s(e.mergedOptions.bar.hBar,"pos",e.mergedOptions.rail.hRail),s(e.mergedOptions.bar.hBar,"height",e.mergedOptions.rail.hRail),s(e.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+e.mergedOptions.rail.vRail.pos}),s(e.mergedOptions.scrollContent,"paddValue",function(){return e.mergedOptions.rail.vRail.width})}}).call(this),this.renderError=function(e){var t=!1,i=e.vuescroll,o=e.scrollPanel;~f.indexOf(i.mode)||(h.error('[vuescroll]: The vuescroll\'s option "mode" should be one of the '+f),t=!0),i.paging==i.snapping.enable&&i.paging&&(i.pullRefresh||i.pushLoad)&&h.error("[vuescroll]: paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var s=o.initialScrollY,l=o.initialScrollX;return s&&!String(s).match(/^\d+(\.\d+)?(%)?$/)&&h.error("[vuescroll]: The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&h.error("[vuescroll]: The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}(this.mergedOptions)}};function y(e,t){return function(i){return t(e,i)}}function S(e,t){var i=null;return"easeInQuad"===e&&(i=t*t),"easeOutQuad"===e&&(i=t*(2-t)),"easeInOutQuad"===e&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(i=t*t*t),"easeOutCubic"===e&&(i=--t*t*t+1),"easeInOutCubic"===e&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(i=t*t*t*t),"easeOutQuart"===e&&(i=1- --t*t*t*t),"easeInOutQuart"===e&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(i=t*t*t*t*t),"easeOutQuint"===e&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),i||t}var T=Date.now||function(){return+new Date},L={},x=1,w={effect:{}},D=null;function z(e,t){var i=void 0;return i=(i=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(i=i[1]-0)/100:e-0}D="undefined"!=typeof window?window:{},w.effect.Animate={requestAnimationFrame:function(e){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,i=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(i=!1),i)return function(e,i){t(e,i)};var o={},s=1,l=null,r=+new Date;return function(e){var t=s++;return o[t]=e,requestCount++,null===l&&(l=setInterval(function(){var e=+new Date,t=o;for(var i in o={},requestCount=0,t)t.hasOwnProperty(i)&&(t[i](e),r=e);e-r>2500&&(clearInterval(l),l=null)},1e3/60)),t}}(D),stop:function(e){var t=null!=L[e];return t&&(L[e]=null),t},isRunning:function(e){return null!=L[e]},start:function(e,t,i,o,s,l){var r=T(),n=r,a=0,c=0,h=x++;if(l||(l=document.body),h%20==0){var _={};for(var u in L)_[u]=!0;L=_}return L[h]=!0,w.effect.Animate.requestAnimationFrame(function _(u){var d=!0!==u,p=T();if(!L[h]||t&&!t(h))return L[h]=null,void(i&&i(60-c/((p-r)/1e3),h,!1));if(d)for(var f=Math.round((p-n)/(1e3/60))-1,m=0;m1&&(a=1);var v=s?s(a):a;!1!==e(v,p,d)&&1!==a||!d?d&&(n=p,w.effect.Animate.requestAnimationFrame(_,l)):(L[h]=null,i&&i(60-c/((p-r)/1e3),h,1===a||null==o))},l),h}};var O={methods:{scrollTo:function(e){var t=e.x,i=e.y,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=u();t=void 0===t?this.vuescroll.state.internalScrollLeft||0:z(t,this.scrollPanelElm.scrollWidth),i=void 0===i?this.vuescroll.state.internalScrollTop||0:z(i,this.scrollPanelElm.scrollHeight-l),this.internalScrollTo(t,i,o,s)},scrollBy:function(e){var t=e.dx,i=void 0===t?0:t,o=e.dy,s=void 0===o?0:o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=u(),n=this.vuescroll.state,a=n.internalScrollLeft,c=void 0===a?0:a,h=n.internalScrollTop,_=void 0===h?0:h;i&&(c+=z(i,this.scrollPanelElm.scrollWidth)),s&&(_+=z(s,this.scrollPanelElm.scrollHeight-r)),this.internalScrollTo(c,_,l)},zoomBy:function(e,t,i,o,s){"slide"==this.mode?this.scroller.zoomBy(e,t,i,o,s):h.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments[2],o=arguments[3],s=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,i,o,s):h.warn("[vuescroll]: zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();h.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):h.warn("[vuescroll]: getCurrentPage and goToPage are only for slide mode and paging is enble!")},getCurrentviewDom:function(){for(var e=this,t=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,i=[],o=function(t){var i=t.getBoundingClientRect(),o=i.left,s=i.top,l=i.width,r=i.height,n=e.$el.getBoundingClientRect(),a=n.left,c=n.top,h=n.height,_=n.width;return o-a+l>0&&o-a<_&&s-c+r>0&&s-c_&&(i=_-r),n+t<0&&(t=-n),n+t>e.scrollWidth&&(t=e.scrollWidth-n);var d=y(s,S);w.effect.Animate.start(function(o){a=n+t*o,c=r+i*o,e.scrollTop=Math.floor(c),e.scrollLeft=Math.floor(a)},function(){return Math.abs(c-r)<=Math.abs(i)||Math.abs(a-n)<=Math.abs(t)},l,o,d)}(this.$refs.scrollPanel.$el,e-this.$refs.scrollPanel.$el.scrollLeft,t-this.$refs.scrollPanel.$el.scrollTop,this.mergedOptions.scrollPanel.speed,this.mergedOptions.scrollPanel.easing,function(){s.updateBarStateAndEmitEvent("handle-scroll-complete")})}else this.$refs.scrollPanel.$el.scrollTop=t,this.$refs.scrollPanel.$el.scrollLeft=e;else"slide"==this.mode&&this.scroller.scrollTo(e,t,i,void 0,o)},scrollIntoView:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.$el;if("string"==typeof e&&(e=i.querySelector(e)),d(e,i)){var o=this.$el.getBoundingClientRect(),s=o.left,l=o.top,r=e.getBoundingClientRect(),n=s-r.left,a=l-r.top;this.scrollBy({dx:-n,dy:-a},t)}else h.warn("[vuescroll]: The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")}}},P={methods:{updateNativeModeBarState:function(){var e=u(),t=this.scrollPanelElm,i=this.$el,o=100*i.clientHeight/(t.scrollHeight-e),s=100*i.clientWidth/t.scrollWidth;this.bar.vBar.state.posValue=100*(t.scrollTop-e)/i.clientHeight,this.bar.hBar.state.posValue=100*t.scrollLeft/i.clientWidth,this.bar.vBar.state.size=o<100?o+"%":0,this.bar.hBar.state.size=s<100?s+"%":0}}},M=null,B=null;function C(e,t){for(var i in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:m,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[i]=t[i];M=y(this.options.animatingEasing,S),B=y(this.options.noAnimatingEasing,S)}var A={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,i,o){e===+e&&(this.__clientWidth=e),t===+t&&(this.__clientHeight=t),i===+i&&(this.__contentWidth=i),o===+o&&(this.__contentHeight=o),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,s=t.startCallback,l=t.beforeDeactivateCallback;this.__refreshHeight=e,this.__refreshActivate=i,this.__refreshBeforeDeactivate=l,this.__refreshDeactivate=o,this.__refreshStart=s},activatePushToLoad:function(e,t){var i=t.activateCallback,o=t.deactivateCallback,s=t.startCallback,l=t.beforeDeactivateCallback;this.__loadHeight=e,this.__loadActivate=i,this.__loadBeforeDeactivate=l,this.__loadDeactivate=o,this.__loadStart=s},triggerRefreshOrLoad:function(){"refresh"==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"refresh")?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart())},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,i,o,s){if(!this.options.zooming)throw new Error("Zooming is not enabled!");s&&(this.__zoomComplete=s),this.__isDecelerating&&(w.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1);var l=this.__zoomLevel;null==i&&(i=this.__clientWidth/2),null==o&&(o=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);var r=(i+this.__scrollLeft)*e/l-i,n=(o+this.__scrollTop)*e/l-o;r>this.__maxScrollLeft?r=this.__maxScrollLeft:r<0&&(r=0),n>this.__maxScrollTop?n=this.__maxScrollTop:n<0&&(n=0),this.__publish(r,n,e,t)},zoomBy:function(e,t,i,o,s){this.zoomTo(this.__zoomLevel*e,t,i,o,s)},scrollTo:function(e,t,i,o,s){if(this.__isDecelerating&&(w.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1),null!=o&&o!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=o,t*=o,this.__computeScrollMax(o)}else o=this.__zoomLevel;this.options.scrollingX||s?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY||s?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(i=!1),this.__isTracking||this.__publish(e,t,o,i)},scrollBy:function(e,t,i){var o=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,s=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(o+(e||0),s+(t||0),i)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var i=e.x,o=e.y;isNaN(i)&&(i=1),isNaN(o)&&(o=1),this.scrollTo((i-1)*this.__clientWidth,(o-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,i,o){var s=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*s,!1,i-this.__clientLeft,o-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i,o;this.__interruptedAnimation=!0,this.__isDecelerating&&(w.effect.Animate.stop(this.__isDecelerating),this.__isDecelerating=!1,this.__interruptedAnimation=!0),this.__isAnimating&&(w.effect.Animate.stop(this.__isAnimating),this.__isAnimating=!1,this.__interruptedAnimation=!0);var s=1===e.length;s?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=i,this.__initialTouchTop=o,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=i,this.__lastTouchTop=o,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!s&&this.options.scrollingX,this.__enableScrollY=!s&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!s,this.__isSingleTouch=s,this.__positions=[]},doTouchMove:function(e,t,i){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(this.__isTracking){var o,s;2===e.length?(o=Math.abs(e[0].pageX+e[1].pageX)/2,s=Math.abs(e[0].pageY+e[1].pageY)/2):(o=e[0].pageX,s=e[0].pageY);var l=this.__positions;if(this.__isDragging){var r=o-this.__lastTouchLeft,n=s-this.__lastTouchTop,a=this.__scrollLeft,c=this.__scrollTop,h=this.__zoomLevel;if(null!=i&&this.options.zooming){var _=h;if(h=h/this.__lastScale*i,_!==(h=Math.max(Math.min(h,this.options.maxZoom),this.options.minZoom))){var u=o-this.__clientLeft,d=s-this.__clientTop;a=(u+a)*h/_-u,c=(d+c)*h/_-d,this.__computeScrollMax(h)}}if(this.__enableScrollX){a-=r*this.options.speedMultiplier;var p=this.__maxScrollLeft;(a>p||a<0)&&(this.options.bouncing?a+=r/2*this.options.speedMultiplier:a=a>p?p:0)}if(this.__enableScrollY){c-=n*this.options.speedMultiplier;var f=this.__maxScrollTop;(c>f||c<0)&&(this.options.bouncing?(c+=n/2*this.options.speedMultiplier,this.__enableScrollX||null==this.__refreshHeight&&null==this.__loadHeight||(!this.__refreshActive&&c<=-this.__refreshHeight?(this.__refreshActive=!0,this.__refreshActivate&&this.__refreshActivate()):this.__refreshActive&&c>-this.__refreshHeight?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):!this.__loadActive&&c>=this.__maxScrollTop+this.__loadHeight?(this.__loadActive=!0,this.__loadActivate&&this.__loadActivate()):this.__refreshActive&&cf?f:0)}l.length>60&&l.splice(0,30),l.push(a,c,t),this.__publish(a,c,h)}else{var m=this.options.locking?3:0,v=Math.abs(o-this.__initialTouchLeft),g=Math.abs(s-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&v>=m,this.__enableScrollY=this.options.scrollingY&&g>=m,l.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(v>=5||g>=5),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=o,this.__lastTouchTop=s,this.__lastTouchMove=t,this.__lastScale=i}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){for(var t=this.__positions,i=t.length-1,o=i,s=i;s>0&&t[s]>this.__lastTouchMove-100;s-=3)o=s;if(o!==i){var l=t[i]-t[o],r=this.__scrollLeft-t[o-2],n=this.__scrollTop-t[o-1];this.__decelerationVelocityX=r/l*(1e3/60),this.__decelerationVelocityY=n/l*(1e3/60);var a=this.options.paging||this.options.snapping?4:1;Math.abs(this.__decelerationVelocityX)>a||Math.abs(this.__decelerationVelocityY)>a?this.__refreshActive||this.__loadActive||this.__startDeceleration(e):this.__scrollComplete()}else this.__scrollComplete()}else e-this.__lastTouchMove>100&&this.__scrollComplete();this.__isDecelerating||(this.__refreshActive&&this.__refreshStart?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()):this.__loadActive&&this.__loadStart?(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&this.__loadStart()):((this.__interruptedAnimation||this.__isDragging)&&this.__scrollComplete(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel),this.__refreshActive?(this.__refreshActive=!1,this.__refreshDeactivate&&this.__refreshDeactivate()):this.__loadActive&&(this.__loadActive=!1,this.__loadDeactivate&&this.__loadDeactivate()))),this.__positions.length=0}},onScroll:m,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,i,o){var s=this;if(!s.__disable){!isNaN(e)&&e||(e=this.__scrollLeft),!isNaN(t)&&t||(t=this.__scrollTop);var l=s.__isAnimating;if(l&&(w.effect.Animate.stop(l),s.__isAnimating=!1),o&&s.options.animating){s.__scheduledLeft=e,s.__scheduledTop=t,s.__scheduledZoom=i;var r=s.__scrollLeft,n=s.__scrollTop,a=s.__zoomLevel,c=e-r,h=t-n,_=i-a;s.__isAnimating=w.effect.Animate.start(function(e,t,i){i&&(s.__scrollLeft=r+c*e,s.__scrollTop=n+h*e,s.__zoomLevel=a+_*e,s.__callback&&(s.__callback(s.__scrollLeft,s.__scrollTop,s.__zoomLevel),s.onScroll()))},function(e){return s.__isAnimating===e},function(e,t,i){t===s.__isAnimating&&(s.__isAnimating=!1),(s.__didDecelerationComplete||i)&&s.__scrollComplete(),s.options.zooming&&(s.__computeScrollMax(),s.__zoomComplete&&(s.__zoomComplete(),s.__zoomComplete=null))},s.options.animationDuration,l?M:B)}else s.__scheduledLeft=s.__scrollLeft=e,s.__scheduledTop=s.__scrollTop=t,s.__scheduledZoom=s.__zoomLevel=i,s.__callback&&(s.__callback(e,t,i),s.onScroll()),s.options.zooming&&(s.__computeScrollMax(),s.__zoomComplete&&(s.__zoomComplete(),s.__zoomComplete=null))}},__computeScrollMax:function(e){null==e&&(e=this.__zoomLevel),this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)},__computePage:function(){var e=this.__clientWidth,t=this.__clientHeight,i=this.__scrollLeft,o=this.__scrollTop;this.__totalXPage=Math.ceil(this.__contentWidth/e),this.__currentPageX=Math.ceil(i/e+1),this.__totalYPage=Math.ceil(this.__contentHeight/t),this.__currentPageY=Math.ceil(o/t+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),i=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),o=e.__clientWidth,s=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/o)*o,e.__minDecelerationScrollTop=Math.floor(i/s)*s,e.__maxDecelerationScrollLeft=Math.ceil(t/o)*o,e.__maxDecelerationScrollTop=Math.ceil(i/s)*s}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop;var l=e.options.snapping?4:.001;e.__isDecelerating=w.effect.Animate.start(function(t,i,o){e.__stepThroughDeceleration(o)},function(){var t=Math.abs(e.__decelerationVelocityX)>=l||Math.abs(e.__decelerationVelocityY)>=l;return t||(e.__didDecelerationComplete=!0),t},function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollComplete(),e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)})},__stepThroughDeceleration:function(e){var t=this.__scrollLeft+this.__decelerationVelocityX,i=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){var o=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);o!==t&&(t=o,this.__decelerationVelocityX=0);var s=Math.max(Math.min(this.__maxDecelerationScrollTop,i),this.__minDecelerationScrollTop);s!==i&&(i=s,this.__decelerationVelocityY=0)}if(e?this.__publish(t,i,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=i),!this.options.paging){this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95}if(this.options.bouncing){var l=0,r=0,n=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;tthis.__maxDecelerationScrollLeft&&(l=this.__maxDecelerationScrollLeft-t),ithis.__maxDecelerationScrollTop&&(r=this.__maxDecelerationScrollTop-i),0!==l&&(l*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=l*n:this.__decelerationVelocityX=l*a),0!==r&&(r*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=r*n:this.__decelerationVelocityY=r*a)}}};for(var E in A)C.prototype[E]=A[E];function k(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function $(e,t,i,o){var s,l=document.documentElement.style,r=null,n=null;t.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?s="presto":"MozAppearance"in l?s="gecko":"WebkitAppearance"in l?s="webkit":"string"==typeof navigator.cpuClass&&(s="trident"),"string"==typeof e&&(n="vertical"==e?(r=0)||o:(r=o)&&0);var a={trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[s],c=document.createElement("div"),h=a+"Perspective";return void 0!==c.style[h]?"string"==typeof e?k({},"transform","translate3d("+r+i+","+n+i+",0)"):function(t,o,s){e.style.transform="translate3d("+-t+i+","+-o+i+",0) scale("+s+")"}:void 0!==c.style.transform?"string"==typeof e?k({},"transform","translate("+r+i+","+n+i+")"):function(t,o,s){e.style.transform="translate("+-t+i+","+-o+i+") scale("+s+")"}:void 0}var R=Object.assign||function(e){for(var t=1;t-1?"DOMMouseScroll":"mousewheel",d,!1),l=function(){e.removeEventListener("mousedown",h,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",u,!1),e.removeEventListener(navigator.userAgent.indexOf("Firefox")>-1?"DOMMouseScroll":"mousewheel",d,!1)}}return t.onScroll=function(){i("onscroll")},l}(this.$el,this.scroller,function(t){switch(t){case"mousedown":e.vuescroll.state.isDragging=!0;break;case"onscroll":e.handleScroll(!1);break;case"mouseup":e.vuescroll.state.isDragging=!1}},s,t);return this.mergedOptions.vuescroll.pullRefresh.enable&&this.registryEvent("refresh"),this.mergedOptions.vuescroll.pushLoad.enable&&this.registryEvent("load"),this.updateScroller(),c},updateSlideModeBarState:function(){var e,t,i=this.$el,o=this.scroller,s=0,l=0,r=i.clientWidth,n=i.clientHeight,a=r+this.scroller.__maxScrollLeft,c=n+this.scroller.__maxScrollTop,h=ro.__maxScrollLeft&&(s=o.__scrollLeft-o.__maxScrollLeft)),_&&(o.__scrollTop<0?l=-o.__scrollTop:o.__scrollTop>o.__maxScrollTop&&(l=o.__scrollTop-o.__maxScrollTop)),e=100*n/(c+l),t=100*r/(a+s);var u=Math.min(Math.max(0,o.__scrollTop),o.__maxScrollTop),d=Math.min(Math.max(0,o.__scrollLeft),o.__maxScrollLeft);this.bar.vBar.state.posValue=100*(u+l)/i.clientHeight,this.bar.hBar.state.posValue=100*(d+s)/i.clientWidth,o.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),o.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t="refresh"==e?"refreshDom":"loadDom",i="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,o="refresh"==e?"refreshStage":"loadStage",s=this.$refs[t].elm||this.$refs[t],l=function(e,t,i,o){var s=i.$listeners,l=function(){i.vuescroll.state[t]="active"},r=function(){i.vuescroll.state[t]="deactive"},n=function(){i.vuescroll.state[t]="start",setTimeout(function(){i.scroller.finishRefreshOrLoad()},2e3)},a=function(e){i.vuescroll.state[t]="beforeDeactive",setTimeout(function(){e()},500)};return s[e+"-activate"]&&(l=function(){i.vuescroll.state[t]="active",i.$emit(e+"-activate",i,o)}),s[e+"-before-deactivate"]&&(a=function(s){i.vuescroll.state[t]="beforeDeactive",i.$emit(e+"-before-deactivate",i,o,s.bind(i.scroller))}),s[e+"-deactivate"]&&(r=function(){i.vuescroll.state[t]="deactive",i.$emit(e+"-deactivate",i,o)}),s[e+"-start"]&&(n=function(){i.vuescroll.state[t]="start",i.$emit(e+"-start",i,o,i.scroller.finishRefreshOrLoad.bind(i.scroller))}),{activateCallback:l,deactivateCallback:r,startCallback:n,beforeDeactivateCallback:a}}(e,o,this,s),r=s.offsetHeight;i.bind(this.scroller)(r,l)}}},X={vertical:{bar:{size:"height",opsSize:"width",posName:"top",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY"},axis:"Y"},horizontal:{bar:{size:"width",opsSize:"height",posName:"left",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX"},axis:"X"}},Y=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null;"native"==this.mode||"pure-native"==this.mode?this.updateNativeModeBarState():"slide"==this.mode&&this.updateSlideModeBarState(),e&&this.emitEvent(e,t)},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e),this.showAndDefferedHideBar()},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.vuescroll.state.timeoutId&&clearTimeout(this.vuescroll.state.timeoutId),this.vuescroll.state.timeoutId=setTimeout(function(){e.vuescroll.state.timeoutId=0,e.hideBar()},500)},emitEvent:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.scrollPanelElm,o=i.scrollHeight,s=i.scrollWidth,l=i.clientHeight,r=i.clientWidth,n=i.scrollTop,a=i.scrollLeft,c={type:"vertical"},h={type:"horizontal"};"slide"==this.mode&&(n=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,l=this.$el.clientHeight,r=this.$el.clientWidth),c.process=Math.min(n/(o-l),1),h.process=Math.min(a/(s-r),1),c.barSize=this.bar.vBar.state.size,h.barSize=this.bar.hBar.state.size,c.scrollTop=n,h.scrollLeft=a,this.$emit(e,c,h,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var e=this;this.destroyResize&&this.destroyResize();var t=null;"slide"==this.mode||"pure-native"==this.mode?t=this.scrollPanelElm:"native"==this.mode&&(t=this.scrollContentElm);var i=function(){e.updateBarStateAndEmitEvent(),e.showAndDefferedHideBar(),"slide"==e.mode&&e.updateScroller()};window.addEventListener("resize",i,!1);var o=p(t,function(){var t={};"slide"==e.mode?(e.updateScroller(),t.width=e.scroller.__contentWidth,t.height=e.scroller.__contentHeight):"native"!=e.mode&&"pure-native"!=e.mode||(t.width=e.scrollPanelElm.scrollWidth,t.height=e.scrollPanelElm.scrollHeight),e.updateBarStateAndEmitEvent("handle-resize",t),e.showAndDefferedHideBar()});this.destroyResize=function(){window.removeEventListener("resize",i,!1),o()}},registryParentResize:function(){this.destroyParentDomResize=p(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.clientHeight+"px",this.vuescroll.state.width=e.clientWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=function(e,t){var i={};switch(e){case"native":case"pure-native":i={x:t.scrollPanelElm.scrollLeft,y:t.scrollPanelElm.scrollTop};break;case"slide":i={x:t.scroller.__scrollLeft,y:t.scroller.__scrollTop}}return i}(e,this);this.vuescroll.state.internalScrollLeft=t.x,this.vuescroll.state.internalScrollTop=t.y},initWatch:function(){var e=this,t={deep:!0,sync:!0};this.$watch("mergedOptions",function(){e.recordCurrentPos(),e.$nextTick(function(){1!=e.isSmallChangeThisTick?(e.registryResize(),e.updateMode(),e.setVsSize()):e.isSmallChangeThisTick=!1})},t),v.forEach(function(i){e.$watch(i,function(){e.isSmallChangeThisTick=!0},t)})},scrollToHash:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||function(e){return/^#[a-zA-Z_]\d*$/.test(e)}(e))){var t=document.querySelector(e);!d(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}}},mounted:function(){this.renderError||("slide"==this.mode&&(this.destroyScroller=this.registryScroller()),this.$el._isVuescroll=!0,this.lastMode=this.mode,this.registryResize(),this.initWatch(),this.setVsSize(),this.updateBarStateAndEmitEvent(),this.showAndDefferedHideBar(),this.scrollToHash())},updated:function(){var e=this;this.$nextTick(function(){e._isDestroyed||e.showAndDefferedHideBar()})},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)}},F={install:function(e){e.component(Z.name,Z),e.prototype.$vuescrollConfig=o(g,{})},version:"4.5.18"};return"undefined"!=typeof window&&window.Vue&&e.use(F),F}); \ No newline at end of file diff --git a/src/components/child-components/vuescroll-content.js b/src/components/child-components/vuescroll-content.js index a644ccd6..11c5f34f 100644 --- a/src/components/child-components/vuescroll-content.js +++ b/src/components/child-components/vuescroll-content.js @@ -1,4 +1,4 @@ -import { deepMerge } from '../../util'; +import { deepMerge, getScrollError } from '../../util'; // scrollContent export default { name: 'scrollContent', @@ -14,6 +14,7 @@ export default { }, render(h, { props, slots }) { let style = deepMerge(props.state.style, {}); + const error = getScrollError(); style.position = 'relative'; style.minHeight = '100%'; style.minWidth = '100%'; @@ -22,6 +23,9 @@ export default { if (props.ops.padding) { style[props.ops.paddPos] = props.ops.paddValue; } + if (error) { + style.marginBottom = `-${error}px`; + } return h( props.ops.tag, { diff --git a/src/mixins/api.js b/src/mixins/api.js index 157a5169..c4f44519 100644 --- a/src/mixins/api.js +++ b/src/mixins/api.js @@ -3,7 +3,7 @@ import { easingPattern } from '../third-party/easingPattern'; import { core } from '../third-party/scroller/animate'; -import { log, getRealScrollHeight, isChildInParent } from '../util'; +import { log, getScrollError, isChildInParent } from '../util'; function getNumericValue(distance, size) { let number; @@ -28,7 +28,8 @@ function goScrolling(elm, deltaX, deltaY, speed, easing, scrollingComplete) { if (startLocationY + deltaY < 0) { deltaY = -startLocationY; } - const scrollHeight = getRealScrollHeight(elm['scrollHeight']); + const error = getScrollError(); + const scrollHeight = elm['scrollHeight'] - error; if (startLocationY + deltaY > scrollHeight) { deltaY = scrollHeight - startLocationY; } @@ -68,6 +69,7 @@ export default { methods: { // public api scrollTo({ x, y }, animate = true, force = false) { + const error = getScrollError(); if (typeof x === 'undefined') { x = this.vuescroll.state.internalScrollLeft || 0; } else { @@ -76,14 +78,12 @@ export default { if (typeof y === 'undefined') { y = this.vuescroll.state.internalScrollTop || 0; } else { - y = getNumericValue( - y, - getRealScrollHeight(this.scrollPanelElm.scrollHeight) - ); + y = getNumericValue(y, this.scrollPanelElm.scrollHeight - error); } this.internalScrollTo(x, y, animate, force); }, scrollBy({ dx = 0, dy = 0 }, animate = true) { + const error = getScrollError(); let { internalScrollLeft = 0, internalScrollTop = 0 @@ -97,7 +97,7 @@ export default { if (dy) { internalScrollTop += getNumericValue( dy, - getRealScrollHeight(this.scrollPanelElm.scrollHeight) + this.scrollPanelElm.scrollHeight - error ); } this.internalScrollTo(internalScrollLeft, internalScrollTop, animate); diff --git a/src/mixins/mode/native-mode.js b/src/mixins/mode/native-mode.js index c01e5d85..93e81fe6 100644 --- a/src/mixins/mode/native-mode.js +++ b/src/mixins/mode/native-mode.js @@ -1,17 +1,16 @@ -import { getRealScrollHeight } from '../../util'; +import { getScrollError } from '../../util'; export default { methods: { updateNativeModeBarState() { + const error = getScrollError(); const scrollPanel = this.scrollPanelElm; const vuescroll = this.$el; let heightPercentage = - vuescroll.clientHeight * - 100 / - getRealScrollHeight(scrollPanel.scrollHeight); + vuescroll.clientHeight * 100 / (scrollPanel.scrollHeight - error); let widthPercentage = vuescroll.clientWidth * 100 / scrollPanel.scrollWidth; this.bar.vBar.state.posValue = - scrollPanel.scrollTop * 100 / vuescroll.clientHeight; + (scrollPanel.scrollTop - error) * 100 / vuescroll.clientHeight; this.bar.hBar.state.posValue = scrollPanel.scrollLeft * 100 / vuescroll.clientWidth; this.bar.vBar.state.size = diff --git a/src/util/index.js b/src/util/index.js index fee0e7b2..e56fa0d1 100644 --- a/src/util/index.js +++ b/src/util/index.js @@ -170,14 +170,14 @@ export function eventCenter( export const log = console; let error; -// It only happens when child is inline-block, +// It only happens when child is inline-block in chrome, // scollheight will have a error of -// 4px in chrome or some other browsers. -// So write a method to get the error and get the real scrollHeight. -export function getRealScrollHeight(scrollHeight) { +// 4px, so write a method to compute the error. +// https://stackoverflow.com/questions/29132892/how-to-auto-resize-an-input-field-vertically-and-not-horizontally-like-facebook/29133328#29133328 +export function getScrollError() { /* istanbul ignore next */ if (Vue.prototype.$isServer) return 0; - if (error !== undefined) return scrollHeight - error; + if (error !== undefined) return error; const outer = document.createElement('div'); outer.style.visibility = 'hidden'; outer.style.height = '100px'; @@ -192,7 +192,7 @@ export function getRealScrollHeight(scrollHeight) { outer.appendChild(inner); error = outer.scrollHeight - outer.clientHeight; outer.parentNode.removeChild(outer); - return scrollHeight - error; + return error; } export function isChildInParent(child, parent) { diff --git a/test/unit/specs/api.spec.js b/test/unit/specs/api.spec.js index 15614157..71dfb8f0 100644 --- a/test/unit/specs/api.spec.js +++ b/test/unit/specs/api.spec.js @@ -43,10 +43,7 @@ describe('api', () => { .then(r => { const scrollPanel = vm.$el.querySelector('.vuescroll-panel'); const { scrollTop } = scrollPanel; - // note: in chrome , scrollHeight is added extra 4px than actual content - // so we should add 4 to let test pass.\ - // https://stackoverflow.com/questions/29132892/how-to-auto-resize-an-input-field-vertically-and-not-horizontally-like-facebook/29133328#29133328 - expect(Math.ceil(scrollTop)).toBe(104); + expect(Math.ceil(scrollTop)).toBe(100); // scroll X axis vs.scrollTo( {