sifangpay/public/style/web/h5/js/vue-pull-to.js

3 lines
18 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VuePullTo=e():t.VuePullTo=e()}(this,function(){return function(t){function e(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var o={};return e.m=t,e.c=o,e.i=function(t){return t},e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=11)}([function(t,e,o){t.exports=!o(1)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var o=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=o)},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var o=t.exports={version:"2.5.1"};"number"==typeof __e&&(__e=o)},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,o){var n=o(19);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,e){var o=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:o)(t)}},function(t,e,o){var n=o(6),i=o(5);t.exports=function(t){return n(i(t))}},function(t,e,o){o(46);var n=o(44)(o(13),o(45),"data-v-12abd9fb",null);t.exports=n.exports},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={pullText:"下拉刷新",triggerText:"释放更新",loadingText:"加载中...",doneText:"加载完成",failText:"加载失败",loadedStayTime:400,stayDistance:50,triggerDistance:70},i={pullText:"上拉加载",triggerText:"释放更新",loadingText:"加载中...",doneText:"加载完成",failText:"加载失败",loadedStayTime:400,stayDistance:50,triggerDistance:70};e.TOP_DEFAULT_CONFIG=n,e.BOTTOM_DEFAULT_CONFIG=i},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(o(9));e.default=n.default,t.exports=e.default},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throttle=function(t,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=null,i=void 0;return function(){var r=this,s=arguments,a=+new Date;clearTimeout(n),i||(i=a),0!==o&&a-i>=o?(t.apply(r,s),i=a):n=setTimeout(function(){t.apply(r,s)},e)}}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(o(14)),i=o(12),r=o(10);e.default={name:"vue-pull-to",props:{distanceIndex:{type:Number,default:2},topBlockHeight:{type:Number,default:50},bottomBlockHeight:{type:Number,default:50},wrapperHeight:{type:String,default:"100%"},topLoadMethod:{type:Function},bottomLoadMethod:{type:Function},isThrottleTopPull:{type:Boolean,default:!0},isThrottleBottomPull:{type:Boolean,default:!0},isThrottleScroll:{type:Boolean,default:!0},isTopBounce:{type:Boolean,default:!0},isBottomBounce:{type:Boolean,default:!0},topConfig:{type:Object,default:function(){return{}}},bottomConfig:{type:Object,default:function(){return{}}}},data:function(){return{scrollEl:null,startScrollTop:0,startY:0,currentY:0,distance:0,direction:0,diff:0,beforeDiff:0,topText:"",bottomText:"",state:"",bottomReached:!1,throttleEmitTopPull:null,throttleEmitBottomPull:null,throttleEmitScroll:null,throttleOnInfiniteScroll:null}},computed:{_topConfig:function(){return(0,n.default)({},r.TOP_DEFAULT_CONFIG,this.topConfig)},_bottomConfig:function(){return(0,n.default)({},r.BOTTOM_DEFAULT_CONFIG,this.bottomConfig)}},watch:{state:function(t){"down"===this.direction?this.$emit("top-state-change",t):this.$emit("bottom-state-change",t)}},methods:{actionPull:function(){this.state="pull","down"===this.direction?this.topText=this._topConfig.pullText:this.bottomText=this._bottomConfig.pullText},actionTrigger:function(){this.state="trigger","down"===this.direction?this.topText=this._topConfig.triggerText:this.bottomText=this._bottomConfig.triggerText},actionLoading:function(){this.state="loading","down"===this.direction?(this.topText=this._topConfig.loadingText,this.topLoadMethod.call(this,this.actionLoaded),this.scrollTo(this._topConfig.stayDistance)):(this.bottomText=this._bottomConfig.loadingText,this.bottomLoadMethod.call(this,this.actionLoaded),this.scrollTo(-this._bottomConfig.stayDistance))},actionLoaded:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"done";this.state="loaded-"+e;var o=void 0;"down"===this.direction?(this.topText="done"===e?this._topConfig.doneText:this._topConfig.failText,o=this._topConfig.loadedStayTime):(this.bottomText="done"===e?this._bottomConfig.doneText:this._bottomConfig.failText,o=this._bottomConfig.loadedStayTime),setTimeout(function(){t.scrollTo(0),setTimeout(function(){t.state=""},200)},o)},scrollTo:function(t){var e=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;this.$el.style.transition=o+"ms",this.diff=t,setTimeout(function(){e.$el.style.transition=""},o)},checkBottomReached:function(){return this.scrollEl.scrollTop+this.scrollEl.offsetHeight+1>=this.scrollEl.scrollHeight},handleTouchStart:function(t){this.startY=t.touches[0].clientY,this.beforeDiff=this.diff,this.startScrollTop=this.scrollEl.scrollTop,this.bottomReached=this.checkBottomReached()},handleTouchMove:function(t){if(this.currentY=t.touches[0].clientY,this.distance=(this.currentY-this.startY)/this.distanceIndex+this.beforeDiff,this.direction=this.distance>0?"down":"up",0===this.startScrollTop&&"down"===this.direction&&this.isTopBounce){if(t.preventDefault(),t.stopPropagation(),this.diff=this.distance,this.isThrottleTopPull?this.throttleEmitTopPull(this.diff):this.$emit("top-pull",this.diff),"function"!=typeof this.topLoadMethod)return;this.distance<this._topConfig.triggerDistance&&"pull"!==this.state&&"loading"!==this.state?this.actionPull():this.distance>=this._topConfig.triggerDistance&&"trigger"!==this.state&&"loading"!==this.state&&this.actionTrigger()}else if(this.bottomReached&&"up"===this.direction&&this.isBottomBounce){if(t.preventDefault(),t.stopPropagation(),this.diff=this.distance,this.isThrottleBottomPull?this.throttleEmitBottomPull(this.diff):this.$emit("bottom-pull",this.diff),"function"!=typeof this.bottomLoadMethod)return;Math.abs(this.distance)<this._bottomConfig.triggerDistance&&"pull"!==this.state&&"loading"!==this.state?this.actionPull():Math.abs(this.distance)>=this._bottomConfig.triggerDistance&&"trigger"!==this.state&&"loading"!==this.state&&this.actionTrigger()}},handleTouchEnd:function(){if(0!==this.diff){if("trigger"===this.state)return void this.actionLoading();this.scrollTo(0)}},handleScroll:function(t){this.isThrottleScroll?this.throttleEmitScroll(t):this.$emit("scroll",t),this.throttleOnInfiniteScroll()},onInfiniteScroll:function(){this.checkBottomReached()&&this.$emit("infinite-scroll")},throttleEmit:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments[2];return(0,i.throttle)(function(){var t=[].concat(Array.prototype.slice.call(arguments));t.unshift(o),this.$emit.apply(this,t)},t,e)},bindEvents:function(){this.scrollEl.addEventListener("touchstart",this.handleTouchStart),this.scrollEl.addEventListener("touchmove",this.handleTouchMove),this.scrollEl.addEventListener("touchend",this.handleTouchEnd),this.scrollEl.addEventListener("scroll",this.handleScroll)},createThrottleMethods:function(){this.throttleEmitTopPull=this.throttleEmit(200,300,"top-pull"),this.throttleEmitBottomPull=this.throttleEmit(200,300,"bottom-pull"),this.throttleEmitScroll=this.throttleEmit(100,150,"scroll"),this.throttleOnInfiniteScroll=(0,i.throttle)(this.onInfiniteScroll,400)},init:function(){this.createThrottleMethods(),this.scrollEl=this.$el.querySelector(".scroll-container"),this.bindEvents()}},mounted:function(){this.init()}},t.exports=e.default},function(t,e,o){t.exports={default:o(15),__esModule:!0}},function(t,e,o){o(41),t.exports=o(4).Object.assign},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,o){var n=o(3);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,o){var n=o(8),i=o(37),r=o(36);t.exports=function(t){return function(e,o,s){var a,c=n(e),u=i(c.length),l=r(s,u);if(t&&o!=o){for(;u>l;)if((a=c[l++])!=a)return!0}else for(;u>l;l++)if((t||l in c)&&c[l]===o)return t||l||0;return!t&&-1}}},function(t,e){var o={}.toString;t.exports=function(t){return o.call(t).slice(8,-1)}},function(t,e,o){var n=o(16);t.exports=function(t,e,o){if(n(t),void 0===e)return t;switch(o){case 1:return function(o){return t.call(e,o)};case 2:return function(o,n){return t.call(e,o,n)};case 3:return function(o,n,i){return t.call(e,o,n,i)}}return function(){return t.apply(e,arguments)}}},function(t,e,o){var n=o(3),i=o(2).document,r=n(i)&&n(i.createElement);t.exports=function(t){return r?i.createElement(t):{}}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,o){var n=o(2),i=o(4),r=o(20),s=o(25),a=function(t,e,o){var c,u,l,f=t&a.F,h=t&a.G,d=t&a.S,p=t&a.P,g=t&a.B,v=t&a.W,m=h?i:i[e]||(i[e]={}),b=m.prototype,x=h?n:d?n[e]:(n[e]||{}).prototype;h&&(o=e);for(c in o)(u=!f&&x&&void 0!==x[c])&&c in m||(l=u?x[c]:o[c],m[c]=h&&"function"!=typeof x[c]?o[c]:g&&u?r(l,n):v&&x[c]==l?function(t){var e=function(e,o,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,o)}return new t(e,o,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):p&&"function"==typeof l?r(Function.call,l):l,p&&((m.virtual||(m.virtual={}))[c]=l,t&a.R&&b&&!b[c]&&s(b,c,l)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e){var o={}.hasOwnProperty;t.exports=function(t,e){return o.call(t,e)}},function(t,e,o){var n=o(28),i=o(33);t.exports=o(0)?function(t,e,o){return n.f(t,e,i(1,o))}:function(t,e,o){return t[e]=o,t}},function(t,e,o){t.exports=!o(0)&&!o(1)(function(){return 7!=Object.defineProperty(o(21)("div"),"a",{get:function(){return 7}}).a})},function(t,e,o){"use strict";var n=o(31),i=o(29),r=o(32),s=o(38),a=o(6),c=Object.assign;t.exports=!c||o(1)(function(){var t={},e={},o=Symbol(),n="abcdefghijklmnopqrst";return t[o]=7,n.split("").forEach(function(t){e[t]=t}),7!=c({},t)[o]||Object.keys(c({},e)).join("")!=n})?function(t,e){for(var o=s(t),c=arguments.length,u=1,l=i.f,f=r.f;c>u;)for(var h,d=a(arguments[u++]),p=l?n(d).concat(l(d)):n(d),g=p.length,v=0;g>v;)f.call(d,h=p[v++])&&(o[h]=d[h]);return o}:c},function(t,e,o){var n=o(17),i=o(26),r=o(39),s=Object.defineProperty;e.f=o(0)?Object.defineProperty:function(t,e,o){if(n(t),e=r(e,!0),n(o),i)try{return s(t,e,o)}catch(t){}if("get"in o||"set"in o)throw TypeError("Accessors not supported!");return"value"in o&&(t[e]=o.value),t}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,o){var n=o(24),i=o(8),r=o(18)(!1),s=o(34)("IE_PROTO");t.exports=function(t,e){var o,a=i(t),c=0,u=[];for(o in a)o!=s&&n(a,o)&&u.push(o);for(;e.length>c;)n(a,o=e[c++])&&(~r(u,o)||u.push(o));return u}},function(t,e,o){var n=o(30),i=o(22);t.exports=Object.keys||function(t){return n(t,i)}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,o){var n=o(35)("keys"),i=o(40);t.exports=function(t){return n[t]||(n[t]=i(t))}},function(t,e,o){var n=o(2),i=n["__core-js_shared__"]||(n["__core-js_shared__"]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e,o){var n=o(7),i=Math.max,r=Math.min;t.exports=function(t,e){return(t=n(t))<0?i(t+e,0):r(t,e)}},function(t,e,o){var n=o(7),i=Math.min;t.exports=function(t){return t>0?i(n(t),9007199254740991):0}},function(t,e,o){var n=o(5);t.exports=function(t){return Object(n(t))}},function(t,e,o){var n=o(3);t.exports=function(t,e){if(!n(t))return t;var o,i;if(e&&"function"==typeof(o=t.toString)&&!n(i=o.call(t)))return i;if("function"==typeof(o=t.valueOf)&&!n(i=o.call(t)))return i;if(!e&&"function"==typeof(o=t.toString)&&!n(i=o.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e){var o=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++o+n).toString(36))}},function(t,e,o){var n=o(23);n(n.S+n.F,"Object",{assign:o(27)})},function(t,e,o){(t.exports=o(43)(void 0)).push([t.i,".vue-pull-to-wrapper[data-v-12abd9fb]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;height:100%}.scroll-container[data-v-12abd9fb]{-webkit-box-flex:1;-webkit-flex:1;flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}.vue-pull-to-wrapper .action-block[data-v-12abd9fb]{position:relative;width:100%}.default-text[data-v-12abd9fb]{height:100%;line-height:50px;text-align:center}",""])},function(t,e){function o(t,e){var o=t[1]||"",i=t[3];if(!i)return o;if(e&&"function"==typeof btoa){var r=n(i),s=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[o].concat(s).concat([r]).join("\n")}return[o].join("\n")}function n(t){return"/*# "+("sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t)))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=o(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,o){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(n[r]=!0)}for(i=0;i<t.length;i++){var s=t[i];"number"==typeof s[0]&&n[s[0]]||(o&&!s[2]?s[2]=o:o&&(s[2]="("+s[2]+") and ("+o+")"),e.push(s))}},e}},function(t,e){t.exports=function(t,e,o,n){var i,r=t=t||{},s=typeof t.default;"object"!==s&&"function"!==s||(i=t,r=t.default);var a="function"==typeof r?r.options:r;if(e&&(a.render=e.render,a.staticRenderFns=e.staticRenderFns),o&&(a._scopeId=o),n){var c=Object.create(a.computed||null);Object.keys(n).forEach(function(t){var e=n[t];c[t]=function(){return e}}),a.computed=c}return{esModule:i,exports:r,options:a}}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"vue-pull-to-wrapper",style:{height:t.wrapperHeight,transform:"translate3d(0, "+t.diff+"px, 0)"}},[t.topLoadMethod?o("div",{staticClass:"action-block",style:{height:t.topBlockHeight+"px",marginTop:-t.topBlockHeight+"px"}},[t._t("top-block",[o("p",{staticClass:"default-text"},[t._v(t._s(t.topText))])],{state:t.state,stateText:t.topText})],2):t._e(),t._v(" "),o("div",{staticClass:"scroll-container"},[t._t("default")],2),t._v(" "),t.bottomLoadMethod?o("div",{staticClass:"action-block",style:{height:t.bottomBlockHeight+"px",marginBottom:-t.bottomBlockHeight+"px"}},[t._t("bottom-block",[o("p",{staticClass:"default-text"},[t._v(t._s(t.bottomText))])],{state:t.state,stateText:t.bottomText})],2):t._e()])},staticRenderFns:[]}},function(t,e,o){var n=o(42);"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);o(47)("0cd817f2",n,!0)},function(t,e,o){function n(t){for(var e=0;e<t.length;e++){var o=t[e],n=l[o.id];if(n){n.refs++;for(s=0;s<n.parts.length;s++)n.parts[s](o.parts[s]);for(;s<o.parts.length;s++)n.parts.push(r(o.parts[s]));n.parts.length>o.parts.length&&(n.parts.length=o.parts.length)}else{for(var i=[],s=0;s<o.parts.length;s++)i.push(r(o.parts[s]));l[o.id]={id:o.id,refs:1,parts:i}}}}function i(){var t=document.createElement("style");return t.type="text/css",f.appendChild(t),t}function r(t){var e,o,n=document.querySelector('style[data-vue-ssr-id~="'+t.id+'"]');if(n){if(p)return g;n.parentNode.removeChild(n)}if(v){var r=d++;n=h||(h=i()),e=s.bind(null,n,r,!1),o=s.bind(null,n,r,!0)}else n=i(),e=a.bind(null,n),o=function(){n.parentNode.removeChild(n)};return e(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;e(t=n)}else o()}}function s(t,e,o,n){var i=o?"":n.css;if(t.styleSheet)t.styleSheet.cssText=m(e,i);else{var r=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function a(t,e){var o=e.css,n=e.media,i=e.sourceMap;if(n&&t.setAttribute("media",n),i&&(o+="\n/*# sourceURL="+i.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),t.styleSheet)t.styleSheet.cssText=o;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(o))}}var c="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!c)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var u=o(48),l={},f=c&&(document.head||document.getElementsByTagName("head")[0]),h=null,d=0,p=!1,g=function(){},v="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,o){p=o;var i=u(t,e);return n(i),function(e){for(var o=[],r=0;r<i.length;r++){var s=i[r];(a=l[s.id]).refs--,o.push(a)}e?n(i=u(t,e)):i=[];for(r=0;r<o.length;r++){var a=o[r];if(0===a.refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete l[a.id]}}}};var m=function(){var t=[];return function(e,o){return t[e]=o,t.filter(Boolean).join("\n")}}()},function(t,e){t.exports=function(t,e){for(var o=[],n={},i=0;i<e.length;i++){var r=e[i],s=r[0],a={id:t+":"+i,css:r[1],media:r[2],sourceMap:r[3]};n[s]?n[s].parts.push(a):o.push(n[s]={id:s,parts:[a]})}return o}}])});
//# sourceMappingURL=vue-pull-to.min.js.map