Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-data-loading

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-data-loading - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

14

dist/index.js

@@ -679,6 +679,2 @@ (function webpackUniversalModuleDefinition(root, factory) {

default: false
},
watchScroll: {
type: Boolean,
default: false
}

@@ -703,4 +699,3 @@ },

PULL_DOWN: 'pull-down',
INFINITE_SCROLL: 'infinite-scroll',
ORIGIN_SCROLL: 'scrolling'
INFINITE_SCROLL: 'infinite-scroll'
};

@@ -743,9 +738,2 @@ },

this.updateView();
if (this.watchScroll) {
var container = window === this._container ? document.documentElement : this._container;
var scrollTop = container.scrollTop,
scrollLeft = container.scrollLeft;
this.$emit(this.ORIGIN_SCROLL, { scrollTop: scrollTop, scrollLeft: scrollLeft });
}
if (this.loading || this.completed) {

@@ -752,0 +740,0 @@ return;

2

dist/index.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("VueDataLoading",[],t):"object"==typeof exports?exports.VueDataLoading=t():e.VueDataLoading=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);"undefined"!=typeof window&&window.Vue&&window.Vue.component("vue-data-loading",i.a),t.default=i.a},function(e,t,n){"use strict";function i(e){n(2)}var o=n(8),a=n(9),s=n(7),r=i,l=s(o.a,a.a,!1,r,null,null);t.a=l.exports},function(e,t,n){var i=n(3);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);n(5)("672bf7d5",i,!0)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"\n.vue-data-loading .loading-header, .vue-data-loading .loading-footer {\n position: relative;\n text-align: center;\n font-size: 0.8em;\n color: #868e96;\n}\n.vue-data-loading .loading-header .header-text, .vue-data-loading .loading-header .footer-text, .vue-data-loading .loading-footer .header-text, .vue-data-loading .loading-footer .footer-text {\n width: 100%;\n position: absolute;\n}\n.vue-data-loading .loading-header .header-text, .vue-data-loading .loading-footer .header-text {\n bottom: 20px;\n}\n.vue-data-loading .loading-header .footer-text, .vue-data-loading .loading-footer .footer-text {\n top: 20px;\n}\n",""])},function(e,t){function n(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var a=i(o);return[n].concat(o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"})).concat([a]).join("\n")}return[n].join("\n")}function i(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i=n(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(i[a]=!0)}for(o=0;o<e.length;o++){var s=e[o];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(e,t,n){function i(e){for(var t=0;t<e.length;t++){var n=e[t],i=u[n.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](n.parts[o]);for(;o<n.parts.length;o++)i.parts.push(a(n.parts[o]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{for(var s=[],o=0;o<n.parts.length;o++)s.push(a(n.parts[o]));u[n.id]={id:n.id,refs:1,parts:s}}}}function o(){var e=document.createElement("style");return e.type="text/css",c.appendChild(e),e}function a(e){var t,n,i=document.querySelector('style[data-vue-ssr-id~="'+e.id+'"]');if(i){if(f)return v;i.parentNode.removeChild(i)}if(g){var a=p++;i=h||(h=o()),t=s.bind(null,i,a,!1),n=s.bind(null,i,a,!0)}else i=o(),t=r.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}function s(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=L(t,o);else{var a=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function r(e,t){var n=t.css,i=t.media,o=t.sourceMap;if(i&&e.setAttribute("media",i),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)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 d=n(6),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),h=null,p=0,f=!1,v=function(){},g="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,n){f=n;var o=d(e,t);return i(o),function(t){for(var n=[],a=0;a<o.length;a++){var s=o[a],r=u[s.id];r.refs--,n.push(r)}t?(o=d(e,t),i(o)):o=[];for(var a=0;a<n.length;a++){var r=n[a];if(0===r.refs){for(var l=0;l<r.parts.length;l++)r.parts[l]();delete u[r.id]}}}};var L=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t){for(var n=[],i={},o=0;o<t.length;o++){var a=t[o],s=a[0],r=a[1],l=a[2],d=a[3],u={id:e+":"+o,css:r,media:l,sourceMap:d};i[s]?i[s].parts.push(u):n.push(i[s]={id:s,parts:[u]})}return n}},function(e,t){e.exports=function(e,t,n,i,o,a){var s,r=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(s=e,r=e.default);var d="function"==typeof r?r.options:r;t&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0),n&&(d.functional=!0),o&&(d._scopeId=o);var u;if(a?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=u):i&&(u=i),u){var c=d.functional,h=c?d.render:d.beforeCreate;c?(d._injectStyles=u,d.render=function(e,t){return u.call(t),h(e,t)}):d.beforeCreate=h?[].concat(h,u):[u]}return{esModule:s,exports:r,options:d}}},function(e,t,n){"use strict";t.a={props:{loading:{type:Boolean,default:!1},completed:{type:Boolean,default:!1},distance:{type:Number,default:60},offset:{type:Number,default:0},listens:{type:Array,default:function(){return["infinite-scroll","pull-down","pull-up"]}},container:{type:String},initScroll:{type:Boolean,default:!1},watchScroll:{type:Boolean,default:!1}},data:function(){return{margin:{top:0,bottom:0},pull:{from:-1,to:-1,distance:0,type:null,available:!1},loadingType:null,PULL_UP:"pull-up",PULL_DOWN:"pull-down",INFINITE_SCROLL:"infinite-scroll",ORIGIN_SCROLL:"scrolling"}},computed:{_container:function(){return this.container?this.$parent.$refs[this.container]:window.window},pullHeight:function(){return this.pull.distance>this.distance?this.distance:this.pull.distance}},watch:{loading:function(e,t){t&&!e&&(this.resetPull(),this.setLoadingType())}},methods:{updateView:function(){var e=this.$el.getBoundingClientRect(),t=e.top,n=e.height;this.margin={top:t,bottom:window.innerHeight-(n+t+this.offset)}},setLoadingType:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.loadingType=e},handleScroll:function(){if(this.updateView(),this.watchScroll){var e=window===this._container?document.documentElement:this._container,t=e.scrollTop,n=e.scrollLeft;this.$emit(this.ORIGIN_SCROLL,{scrollTop:t,scrollLeft:n})}this.loading||this.completed||this.margin.bottom>=0&&(this.$emit(this.INFINITE_SCROLL),this.setLoadingType(this.INFINITE_SCROLL))},handleTouchStart:function(e){this.loading||!this.hasListen(this.PULL_UP)&&!this.hasListen(this.PULL_DOWN)||this.margin.top<0&&this.margin.bottom<0||(this.pull.from=e.touches.item(0).pageY)},handleTouchMove:function(e){if(!(this.loading||this.pull.from<0)){this.pull.to=e.touches.item(0).pageY;var t=this.pull.to-this.pull.from;t>0&&this.margin.top>0&&this.hasListen(this.PULL_DOWN)?this.pull.type=this.PULL_DOWN:t<0&&this.margin.bottom>0&&this.hasListen(this.PULL_UP)?this.pull.type=this.PULL_UP:this.pull.type=null,this.pull.distance=Math.abs(t),this.pull.available=this.pull.distance>=this.distance}},handleTouchEnd:function(){this.pull.distance>=this.distance?this.PULL_UP!==this.pull.type&&this.PULL_DOWN!==this.pull.type||(this.$emit(this.pull.type),this.setLoadingType(this.pull.type)):this.resetPull()},resetPull:function(){this.pull={from:-1,to:-1,distance:0,type:null,available:!1}},bindEvents:function(){var e=this;this.hasListen(this.INFINITE_SCROLL)&&["scroll","resize"].forEach(function(t){e._container.addEventListener(t,e.handleScroll)}),(this.hasListen(this.PULL_UP)||this.hasListen(this.PULL_DOWN))&&(this._container.addEventListener("touchstart",this.handleTouchStart),this._container.addEventListener("touchmove",this.handleTouchMove),this._container.addEventListener("touchend",this.handleTouchEnd))},hasListen:function(e){return this.listens.indexOf(e)>=0},init:function(){this.bindEvents(),this.updateView(),this.initScroll&&this.handleScroll()}},mounted:function(){var e=this;this.$nextTick(function(){e.init()})}}},function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vue-data-loading"},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_DOWN===e.pull.type,expression:"PULL_DOWN === pull.type"}],staticClass:"loading-header",style:{height:e.pullHeight+"px"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.pull.available,expression:"!pull.available"}],staticClass:"header-text"},[e._t(e.PULL_DOWN+"-before",[e._v("下拉刷新数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.pull.available&&e.PULL_DOWN!==e.loadingType,expression:"pull.available && PULL_DOWN !== loadingType"}],staticClass:"header-text"},[e._t(e.PULL_DOWN+"-ready",[e._v("松开刷新数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_DOWN===e.loadingType,expression:"PULL_DOWN === loadingType"}],staticClass:"header-text"},[e._t(e.PULL_DOWN+"-loading",[e._v("刷新中...")])],2)]),e._v(" "),n("div",{staticClass:"loading-content"},[e._t("default")],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_UP===e.pull.type,expression:"PULL_UP === pull.type"}],staticClass:"loading-footer",style:{height:e.pullHeight+"px"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.pull.available,expression:"!pull.available"}],staticClass:"footer-text"},[e._t(e.PULL_UP+"-before",[e._v("上拉加载数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.pull.available&&e.PULL_UP!==e.loadingType,expression:"pull.available && PULL_UP !== loadingType"}],staticClass:"footer-text"},[e._t(e.PULL_UP+"-ready",[e._v("松开加载数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_UP===e.loadingType,expression:"PULL_UP === loadingType"}],staticClass:"footer-text"},[e._t(e.PULL_UP+"-loading",[e._v("加载中...")])],2)]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.loading&&e.INFINITE_SCROLL===e.loadingType,expression:"loading && INFINITE_SCROLL === loadingType"}],staticClass:"loading-footer",style:{height:e.distance+"px"}},[n("div",{staticClass:"footer-text"},[e._t(e.INFINITE_SCROLL+"-loading",[e._v("加载中...")])],2)]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!e.loading&&e.completed,expression:"!loading && completed"}],staticClass:"loading-footer",style:{height:e.distance+"px"}},[n("div",{staticClass:"footer-text"},[e._t(e.completed,[e._v("加载完毕")])],2)])])},o=[],a={render:i,staticRenderFns:o};t.a=a}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("VueDataLoading",[],t):"object"==typeof exports?exports.VueDataLoading=t():e.VueDataLoading=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);"undefined"!=typeof window&&window.Vue&&window.Vue.component("vue-data-loading",i.a),t.default=i.a},function(e,t,n){"use strict";function i(e){n(2)}var a=n(8),o=n(9),s=n(7),r=i,l=s(a.a,o.a,!1,r,null,null);t.a=l.exports},function(e,t,n){var i=n(3);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);n(5)("672bf7d5",i,!0)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"\n.vue-data-loading .loading-header, .vue-data-loading .loading-footer {\n position: relative;\n text-align: center;\n font-size: 0.8em;\n color: #868e96;\n}\n.vue-data-loading .loading-header .header-text, .vue-data-loading .loading-header .footer-text, .vue-data-loading .loading-footer .header-text, .vue-data-loading .loading-footer .footer-text {\n width: 100%;\n position: absolute;\n}\n.vue-data-loading .loading-header .header-text, .vue-data-loading .loading-footer .header-text {\n bottom: 20px;\n}\n.vue-data-loading .loading-header .footer-text, .vue-data-loading .loading-footer .footer-text {\n top: 20px;\n}\n",""])},function(e,t){function n(e,t){var n=e[1]||"",a=e[3];if(!a)return n;if(t&&"function"==typeof btoa){var o=i(a);return[n].concat(a.sources.map(function(e){return"/*# sourceURL="+a.sourceRoot+e+" */"})).concat([o]).join("\n")}return[n].join("\n")}function i(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i=n(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},a=0;a<this.length;a++){var o=this[a][0];"number"==typeof o&&(i[o]=!0)}for(a=0;a<e.length;a++){var s=e[a];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(e,t,n){function i(e){for(var t=0;t<e.length;t++){var n=e[t],i=u[n.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](n.parts[a]);for(;a<n.parts.length;a++)i.parts.push(o(n.parts[a]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{for(var s=[],a=0;a<n.parts.length;a++)s.push(o(n.parts[a]));u[n.id]={id:n.id,refs:1,parts:s}}}}function a(){var e=document.createElement("style");return e.type="text/css",c.appendChild(e),e}function o(e){var t,n,i=document.querySelector('style[data-vue-ssr-id~="'+e.id+'"]');if(i){if(f)return v;i.parentNode.removeChild(i)}if(g){var o=h++;i=p||(p=a()),t=s.bind(null,i,o,!1),n=s.bind(null,i,o,!0)}else i=a(),t=r.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}function s(e,t,n,i){var a=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=L(t,a);else{var o=document.createTextNode(a),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(o,s[t]):e.appendChild(o)}}function r(e,t){var n=t.css,i=t.media,a=t.sourceMap;if(i&&e.setAttribute("media",i),a&&(n+="\n/*# sourceURL="+a.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)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 d=n(6),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),p=null,h=0,f=!1,v=function(){},g="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,n){f=n;var a=d(e,t);return i(a),function(t){for(var n=[],o=0;o<a.length;o++){var s=a[o],r=u[s.id];r.refs--,n.push(r)}t?(a=d(e,t),i(a)):a=[];for(var o=0;o<n.length;o++){var r=n[o];if(0===r.refs){for(var l=0;l<r.parts.length;l++)r.parts[l]();delete u[r.id]}}}};var L=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t){for(var n=[],i={},a=0;a<t.length;a++){var o=t[a],s=o[0],r=o[1],l=o[2],d=o[3],u={id:e+":"+a,css:r,media:l,sourceMap:d};i[s]?i[s].parts.push(u):n.push(i[s]={id:s,parts:[u]})}return n}},function(e,t){e.exports=function(e,t,n,i,a,o){var s,r=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(s=e,r=e.default);var d="function"==typeof r?r.options:r;t&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0),n&&(d.functional=!0),a&&(d._scopeId=a);var u;if(o?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=u):i&&(u=i),u){var c=d.functional,p=c?d.render:d.beforeCreate;c?(d._injectStyles=u,d.render=function(e,t){return u.call(t),p(e,t)}):d.beforeCreate=p?[].concat(p,u):[u]}return{esModule:s,exports:r,options:d}}},function(e,t,n){"use strict";t.a={props:{loading:{type:Boolean,default:!1},completed:{type:Boolean,default:!1},distance:{type:Number,default:60},offset:{type:Number,default:0},listens:{type:Array,default:function(){return["infinite-scroll","pull-down","pull-up"]}},container:{type:String},initScroll:{type:Boolean,default:!1}},data:function(){return{margin:{top:0,bottom:0},pull:{from:-1,to:-1,distance:0,type:null,available:!1},loadingType:null,PULL_UP:"pull-up",PULL_DOWN:"pull-down",INFINITE_SCROLL:"infinite-scroll"}},computed:{_container:function(){return this.container?this.$parent.$refs[this.container]:window.window},pullHeight:function(){return this.pull.distance>this.distance?this.distance:this.pull.distance}},watch:{loading:function(e,t){t&&!e&&(this.resetPull(),this.setLoadingType())}},methods:{updateView:function(){var e=this.$el.getBoundingClientRect(),t=e.top,n=e.height;this.margin={top:t,bottom:window.innerHeight-(n+t+this.offset)}},setLoadingType:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.loadingType=e},handleScroll:function(){this.updateView(),this.loading||this.completed||this.margin.bottom>=0&&(this.$emit(this.INFINITE_SCROLL),this.setLoadingType(this.INFINITE_SCROLL))},handleTouchStart:function(e){this.loading||!this.hasListen(this.PULL_UP)&&!this.hasListen(this.PULL_DOWN)||this.margin.top<0&&this.margin.bottom<0||(this.pull.from=e.touches.item(0).pageY)},handleTouchMove:function(e){if(!(this.loading||this.pull.from<0)){this.pull.to=e.touches.item(0).pageY;var t=this.pull.to-this.pull.from;t>0&&this.margin.top>0&&this.hasListen(this.PULL_DOWN)?this.pull.type=this.PULL_DOWN:t<0&&this.margin.bottom>0&&this.hasListen(this.PULL_UP)?this.pull.type=this.PULL_UP:this.pull.type=null,this.pull.distance=Math.abs(t),this.pull.available=this.pull.distance>=this.distance}},handleTouchEnd:function(){this.pull.distance>=this.distance?this.PULL_UP!==this.pull.type&&this.PULL_DOWN!==this.pull.type||(this.$emit(this.pull.type),this.setLoadingType(this.pull.type)):this.resetPull()},resetPull:function(){this.pull={from:-1,to:-1,distance:0,type:null,available:!1}},bindEvents:function(){var e=this;this.hasListen(this.INFINITE_SCROLL)&&["scroll","resize"].forEach(function(t){e._container.addEventListener(t,e.handleScroll)}),(this.hasListen(this.PULL_UP)||this.hasListen(this.PULL_DOWN))&&(this._container.addEventListener("touchstart",this.handleTouchStart),this._container.addEventListener("touchmove",this.handleTouchMove),this._container.addEventListener("touchend",this.handleTouchEnd))},hasListen:function(e){return this.listens.indexOf(e)>=0},init:function(){this.bindEvents(),this.updateView(),this.initScroll&&this.handleScroll()}},mounted:function(){var e=this;this.$nextTick(function(){e.init()})}}},function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vue-data-loading"},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_DOWN===e.pull.type,expression:"PULL_DOWN === pull.type"}],staticClass:"loading-header",style:{height:e.pullHeight+"px"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.pull.available,expression:"!pull.available"}],staticClass:"header-text"},[e._t(e.PULL_DOWN+"-before",[e._v("下拉刷新数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.pull.available&&e.PULL_DOWN!==e.loadingType,expression:"pull.available && PULL_DOWN !== loadingType"}],staticClass:"header-text"},[e._t(e.PULL_DOWN+"-ready",[e._v("松开刷新数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_DOWN===e.loadingType,expression:"PULL_DOWN === loadingType"}],staticClass:"header-text"},[e._t(e.PULL_DOWN+"-loading",[e._v("刷新中...")])],2)]),e._v(" "),n("div",{staticClass:"loading-content"},[e._t("default")],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_UP===e.pull.type,expression:"PULL_UP === pull.type"}],staticClass:"loading-footer",style:{height:e.pullHeight+"px"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.pull.available,expression:"!pull.available"}],staticClass:"footer-text"},[e._t(e.PULL_UP+"-before",[e._v("上拉加载数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.pull.available&&e.PULL_UP!==e.loadingType,expression:"pull.available && PULL_UP !== loadingType"}],staticClass:"footer-text"},[e._t(e.PULL_UP+"-ready",[e._v("松开加载数据")])],2),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.PULL_UP===e.loadingType,expression:"PULL_UP === loadingType"}],staticClass:"footer-text"},[e._t(e.PULL_UP+"-loading",[e._v("加载中...")])],2)]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.loading&&e.INFINITE_SCROLL===e.loadingType,expression:"loading && INFINITE_SCROLL === loadingType"}],staticClass:"loading-footer",style:{height:e.distance+"px"}},[n("div",{staticClass:"footer-text"},[e._t(e.INFINITE_SCROLL+"-loading",[e._v("加载中...")])],2)]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!e.loading&&e.completed,expression:"!loading && completed"}],staticClass:"loading-footer",style:{height:e.distance+"px"}},[n("div",{staticClass:"footer-text"},[e._t(e.completed,[e._v("加载完毕")])],2)])])},a=[],o={render:i,staticRenderFns:a};t.a=o}])});
{
"name": "vue-data-loading",
"version": "0.2.2",
"version": "0.2.3",
"description": "Another component for infinite scroll and pull down/up to load data.",

@@ -5,0 +5,0 @@ "homepage": "http://hacknews.xyz",

@@ -130,13 +130,3 @@ # vue-data-loading

#### watch-scroll
Type: boolean
Default: false
The component will trigger `scrolling` once if `true`.
It uses to get `scrollTop` and `scrollLeft` of `container`.
### Events

@@ -156,8 +146,3 @@

#### scrolling
Emit when container are scrolling.
There is a callback param ref to (scrollTop, scrollLeft).
### Slots

@@ -164,0 +149,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc