diff --git a/docs/css/app.c29e6843.css b/docs/css/app.c29e6843.css new file mode 100644 index 0000000..df11a59 --- /dev/null +++ b/docs/css/app.c29e6843.css @@ -0,0 +1 @@ +body{font-size:18px}h1,h2,h3,h4,h5,h6{letter-spacing:0}@media (max-width:640px){#app{padding:3px;width:100%}}#nav{position:fixed;top:0;left:0;right:0;background-color:#9b4cca;color:#fff;height:40px;display:flex;align-items:center;padding-left:1em;white-space:nowrap;overflow-x:auto}@media (max-width:640px){#nav{padding:0;position:relative;background-color:unset;color:unset;height:unset;padding-left:unset;align-items:unset}}#nav a{display:inline-block;color:#fff}@media (max-width:640px){#nav a{margin-bottom:0;margin-right:1em;color:#9b4dca}}#nav .line{margin:0 1em;font-size:14px;color:#a9a9a9}@media (max-width:640px){#nav .line{display:none}}#nav .router-link-exact-active,#nav .router-link-exact-active:hover{color:inherit;cursor:default;text-decoration:underline}@media (max-width:640px){#nav .router-link-exact-active,#nav .router-link-exact-active:hover{border-bottom:1px solid;border-color:#606c76;text-decoration:none}}.example{margin:0 auto;padding:0 2em;width:776px;padding-top:3em}@media (max-width:640px){.example{margin:unset;padding:unset;width:unset;padding-top:unset}}.example-content{margin-top:1em;background-color:#fff;position:relative}.scroll-touch{-webkit-overflow-scrolling:touch}.scroll-touch::-webkit-scrollbar{width:10px}.scroll-touch::-webkit-scrollbar-track{background:#f4f4f4}.scroll-touch::-webkit-scrollbar-thumb{border-radius:0;background:rgba(0,0,0,.12)}.scroll-touch::-webkit-scrollbar-thumb:hover{background:#b2b2b2}code{background-color:pink!important}.name[data-v-1c868cc0]{margin-top:1em}.desc[data-v-1c868cc0]{padding-bottom:3em}.icons[data-v-1c868cc0]{padding-bottom:1em}.icons .btn[data-v-1c868cc0]{margin-right:1em}.head[data-v-1c868cc0]{margin-bottom:3em}.head img[data-v-1c868cc0]{margin-right:.5em;width:auto;height:24px}.title[data-v-1c868cc0]{margin:1em 0}ul[data-v-1c868cc0]{padding-left:.5em}li[data-v-1c868cc0]{list-style-position:outside;margin-left:1em}.introduction[data-v-0c507b69]{font-size:16px;padding:.5em 1em;border-radius:3px;background-color:#f8f8ff}@media (max-width:640px){.introduction[data-v-0c507b69]{display:none}}pre[data-v-99fd125a]{border:none;padding:1em;font-size:14px;border-radius:3px;font-family:Consolas,Monaco,Andale Mono,Lucida Console,monospace}.github-corner[data-v-4799d028]{padding-left:30px;width:100px;height:40px;line-height:40px;position:fixed;right:0;top:0;color:#fff;font-size:14px;font-weight:700;background-size:30px 30px;background-repeat:no-repeat;background-position:0;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M841.6 268.8c32-57.6-3.2-134.4-3.2-134.4-80 0-137.6 54.4-137.6 54.4-32-19.2-134.4-19.2-134.4-19.2s-102.4 0-134.4 19.2c0 0-57.6-54.4-137.6-54.4 0 0-35.2 76.8-3.2 134.4 0 0-70.4 67.2-44.8 211.2 25.6 134.4 144 169.6 220.8 169.6 0 0-32 25.6-25.6 70.4 0 0-44.8 25.6-89.6 9.6-44.8-19.2-67.2-64-67.2-64S240 608 195.2 630.4c0 0-12.8 12.8 35.2 35.2 0 0 35.2 54.4 48 86.4 12.8 32 86.4 57.6 156.8 41.6V896s0 9.6-19.2 12.8c-19.2 3.2-19.2 12.8-9.6 12.8h323.2c9.6 0 9.6-9.6-9.6-12.8-19.2-3.2-19.2-12.8-19.2-12.8V723.2c0-44.8-32-70.4-32-70.4 76.8 0 195.2-35.2 220.8-169.6 22.4-147.2-48-214.4-48-214.4z' fill='%23fff'/%3E%3C/svg%3E")}.tab[data-v-13711752]{width:100%;display:flex;margin-bottom:1em;position:relative}@media (max-width:640px){.tab[data-v-13711752]{display:none}}.tab .tab-item[data-v-13711752]{font-size:14px;font-weight:400;width:85px;margin-right:.5em;height:35px;display:flex;align-items:center;justify-content:center;position:relative;top:1px;cursor:pointer;opacity:.3;background-size:20px 20px;background-repeat:no-repeat;background-position:0}.tab .tab-item.active[data-v-13711752]{opacity:1}.tab .tab-item.view[data-v-13711752]{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cdefs%3E%3Cstyle/%3E%3C/defs%3E%3Cpath d='M512 251.853c192.768 0 358.707 113.1 436.378 276.275H1024c-82.022-202.394-280.218-345.293-512-345.293S82.022 325.735 0 528.128h75.674C153.344 364.954 319.284 251.853 512 251.853zm0 552.55c-192.717 0-358.656-113.05-436.326-276.275H0c82.022 202.445 280.166 345.344 512 345.344s430.029-142.9 512-345.344h-75.674C870.707 691.354 704.768 804.403 512 804.403zM327.834 528.128a184.115 184.115 0 10368.281.051 184.115 184.115 0 00-368.281-.051zm299.315 0a115.2 115.2 0 11-230.298 0 115.2 115.2 0 01230.298 0zm0 0'/%3E%3C/svg%3E")}.tab .tab-item.code[data-v-13711752]{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cdefs%3E%3Cstyle/%3E%3C/defs%3E%3Cpath d='M549.973 128a42.453 42.453 0 00-42.154 37.76l-75.904 683.136a42.325 42.325 0 1084.266 9.387l75.904-683.179A42.325 42.325 0 00550.016 128zM243.541 286.165a42.539 42.539 0 00-30.208 12.502L30.165 481.835a42.624 42.624 0 000 60.33l183.168 183.168a42.667 42.667 0 0060.331-60.33L120.661 512l153.003-153.003a42.624 42.624 0 00-30.165-72.832zm537.003 0a42.667 42.667 0 00-30.165 72.832L903.339 512 750.336 665.003a42.667 42.667 0 0060.33 60.33l183.169-183.168a42.624 42.624 0 000-60.33L810.667 298.667a42.539 42.539 0 00-30.166-12.502z'/%3E%3C/svg%3E")}.tab .complete-code-url[data-v-13711752]{position:absolute;right:0;top:50%;transform:translateY(-50%);font-size:12px} \ No newline at end of file diff --git a/docs/css/app.fd752fac.css b/docs/css/app.fd752fac.css deleted file mode 100644 index 5cb4147..0000000 --- a/docs/css/app.fd752fac.css +++ /dev/null @@ -1 +0,0 @@ -body{font-size:18px}h1,h2,h3,h4,h5,h6{letter-spacing:0}@media (max-width:640px){#app{padding:3px;width:100%}}#nav{position:fixed;top:0;left:0;right:0;background-color:#9b4cca;color:#fff;height:40px;display:flex;align-items:center;padding-left:1em;white-space:nowrap;overflow-x:auto}@media (max-width:640px){#nav{padding:0;position:relative;background-color:unset;color:unset;height:unset;padding-left:unset;align-items:unset}}#nav a{display:inline-block;color:#fff}@media (max-width:640px){#nav a{margin-bottom:0;margin-right:1em;color:#9b4dca}}#nav .line{margin:0 1em;font-size:14px;color:#a9a9a9}@media (max-width:640px){#nav .line{display:none}}#nav .router-link-exact-active,#nav .router-link-exact-active:hover{color:inherit;cursor:default;text-decoration:underline}@media (max-width:640px){#nav .router-link-exact-active,#nav .router-link-exact-active:hover{border-bottom:1px solid;border-color:#606c76;text-decoration:none}}.example{margin:0 auto;padding:0 2em;width:776px;padding-top:3em}@media (max-width:640px){.example{margin:unset;padding:unset;width:unset;padding-top:unset}}.example-content{margin-top:1em;background-color:#fff}.scroll-touch{-webkit-overflow-scrolling:touch}.scroll-touch::-webkit-scrollbar{width:10px}.scroll-touch::-webkit-scrollbar-track{background:#f4f4f4}.scroll-touch::-webkit-scrollbar-thumb{border-radius:0;background:rgba(0,0,0,.12)}.scroll-touch::-webkit-scrollbar-thumb:hover{background:#b2b2b2}code{background-color:pink!important}.name[data-v-1c868cc0]{margin-top:1em}.desc[data-v-1c868cc0]{padding-bottom:3em}.icons[data-v-1c868cc0]{padding-bottom:1em}.icons .btn[data-v-1c868cc0]{margin-right:1em}.head[data-v-1c868cc0]{margin-bottom:3em}.head img[data-v-1c868cc0]{margin-right:.5em;width:auto;height:24px}.title[data-v-1c868cc0]{margin:1em 0}ul[data-v-1c868cc0]{padding-left:.5em}li[data-v-1c868cc0]{list-style-position:outside;margin-left:1em}.introduction[data-v-0c507b69]{font-size:16px;padding:.5em 1em;border-radius:3px;background-color:#f8f8ff}@media (max-width:640px){.introduction[data-v-0c507b69]{display:none}}pre[data-v-99fd125a]{border:none;padding:1em;font-size:14px;border-radius:3px;font-family:Consolas,Monaco,Andale Mono,Lucida Console,monospace}.github-corner[data-v-4799d028]{padding-left:30px;width:100px;height:40px;line-height:40px;position:fixed;right:0;top:0;color:#fff;font-size:14px;font-weight:700;background-size:30px 30px;background-repeat:no-repeat;background-position:0;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M841.6 268.8c32-57.6-3.2-134.4-3.2-134.4-80 0-137.6 54.4-137.6 54.4-32-19.2-134.4-19.2-134.4-19.2s-102.4 0-134.4 19.2c0 0-57.6-54.4-137.6-54.4 0 0-35.2 76.8-3.2 134.4 0 0-70.4 67.2-44.8 211.2 25.6 134.4 144 169.6 220.8 169.6 0 0-32 25.6-25.6 70.4 0 0-44.8 25.6-89.6 9.6-44.8-19.2-67.2-64-67.2-64S240 608 195.2 630.4c0 0-12.8 12.8 35.2 35.2 0 0 35.2 54.4 48 86.4 12.8 32 86.4 57.6 156.8 41.6V896s0 9.6-19.2 12.8c-19.2 3.2-19.2 12.8-9.6 12.8h323.2c9.6 0 9.6-9.6-9.6-12.8-19.2-3.2-19.2-12.8-19.2-12.8V723.2c0-44.8-32-70.4-32-70.4 76.8 0 195.2-35.2 220.8-169.6 22.4-147.2-48-214.4-48-214.4z' fill='%23fff'/%3E%3C/svg%3E")}.tab[data-v-13711752]{width:100%;display:flex;margin-bottom:1em;position:relative}@media (max-width:640px){.tab[data-v-13711752]{display:none}}.tab .tab-item[data-v-13711752]{font-size:14px;font-weight:400;width:85px;margin-right:.5em;height:35px;display:flex;align-items:center;justify-content:center;position:relative;top:1px;cursor:pointer;opacity:.3;background-size:20px 20px;background-repeat:no-repeat;background-position:0}.tab .tab-item.active[data-v-13711752]{opacity:1}.tab .tab-item.view[data-v-13711752]{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cdefs%3E%3Cstyle/%3E%3C/defs%3E%3Cpath d='M512 251.853c192.768 0 358.707 113.1 436.378 276.275H1024c-82.022-202.394-280.218-345.293-512-345.293S82.022 325.735 0 528.128h75.674C153.344 364.954 319.284 251.853 512 251.853zm0 552.55c-192.717 0-358.656-113.05-436.326-276.275H0c82.022 202.445 280.166 345.344 512 345.344s430.029-142.9 512-345.344h-75.674C870.707 691.354 704.768 804.403 512 804.403zM327.834 528.128a184.115 184.115 0 10368.281.051 184.115 184.115 0 00-368.281-.051zm299.315 0a115.2 115.2 0 11-230.298 0 115.2 115.2 0 01230.298 0zm0 0'/%3E%3C/svg%3E")}.tab .tab-item.code[data-v-13711752]{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cdefs%3E%3Cstyle/%3E%3C/defs%3E%3Cpath d='M549.973 128a42.453 42.453 0 00-42.154 37.76l-75.904 683.136a42.325 42.325 0 1084.266 9.387l75.904-683.179A42.325 42.325 0 00550.016 128zM243.541 286.165a42.539 42.539 0 00-30.208 12.502L30.165 481.835a42.624 42.624 0 000 60.33l183.168 183.168a42.667 42.667 0 0060.331-60.33L120.661 512l153.003-153.003a42.624 42.624 0 00-30.165-72.832zm537.003 0a42.667 42.667 0 00-30.165 72.832L903.339 512 750.336 665.003a42.667 42.667 0 0060.33 60.33l183.169-183.168a42.624 42.624 0 000-60.33L810.667 298.667a42.539 42.539 0 00-30.166-12.502z'/%3E%3C/svg%3E")}.tab .complete-code-url[data-v-13711752]{position:absolute;right:0;top:50%;transform:translateY(-50%);font-size:12px} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index e7411a5..e0b0c29 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -vue-virtual-scroll-list
\ No newline at end of file +vue-virtual-scroll-list
\ No newline at end of file diff --git a/docs/index.js b/docs/index.js index c6365ef..607e25e 100644 --- a/docs/index.js +++ b/docs/index.js @@ -1,5 +1,5 @@ /*! - * vue-virtual-scroll-list v2.1.9 + * vue-virtual-scroll-list v2.2.0 * open source under the MIT license * https://github.com/tangbc/vue-virtual-scroll-list#readme */ @@ -647,19 +647,18 @@ if (this.pageMode) { + this.updatePageModeFront(); document.addEventListener('scroll', this.onScroll, { passive: false - }); // taking root offsetTop or offsetLeft as slot header size - - var root = this.$refs.root; - - if (root) { - this.virtual.updateParam('slotHeaderSize', root[this.isHorizontal ? 'offsetLeft' : 'offsetTop']); - } + }); } }, beforeDestroy: function beforeDestroy() { this.virtual.destroy(); + + if (this.pageMode) { + document.removeEventListener('scroll', this.onScroll); + } }, methods: { // get item size by id @@ -742,6 +741,18 @@ }, 3); } }, + // when using page mode we need update slot header size manually + // taking root offset relative to the browser as slot header size + updatePageModeFront: function updatePageModeFront() { + var root = this.$refs.root; + + if (root) { + var rect = root.getBoundingClientRect(); + var defaultView = root.ownerDocument.defaultView; + var offsetFront = this.isHorizontal ? rect.left + defaultView.pageXOffset : rect.top + defaultView.pageYOffset; + this.virtual.updateParam('slotHeaderSize', offsetFront); + } + }, // reset all state back to initial reset: function reset() { this.virtual.destroy(); diff --git a/docs/js/app.13fd1368.js b/docs/js/app.140ab398.js similarity index 63% rename from docs/js/app.13fd1368.js rename to docs/js/app.140ab398.js index fdc8590..a10ec01 100644 --- a/docs/js/app.13fd1368.js +++ b/docs/js/app.140ab398.js @@ -1 +1 @@ -(function(e){function t(t){for(var n,a,o=t[0],l=t[1],c=t[2],h=0,u=[];hthis.range.start)){var t=Math.max(e-this.param.buffer,0);this.checkRange(t,this.getEndByStart(t))}}},{key:"handleBehind",value:function(){var e=this.getScrollOvers();ee&&(a=i-1)}return t>0?--t:0}},{key:"getIndexOffset",value:function(e){if(!e)return 0;for(var t=0,i=0,n=0;n=this.dataSources.length-1)this.scrollToBottom();else{var t=this.virtual.getOffset(e);this.scrollToOffset(t)}},scrollToBottom:function(){var e=this,t=this.$refs.shepherd;if(t){var i=t[this.isHorizontal?"offsetLeft":"offsetTop"];this.scrollToOffset(i),setTimeout((function(){e.getOffset()+e.getClientSize()n||!n||(this.virtual.handleScroll(t),this.emitEvent(t,i,n,e))},emitEvent:function(e,t,i,n){this.$emit("scroll",n,this.virtual.getRange()),this.virtual.isFront()&&this.dataSources.length&&e-this.topThreshold<=0?this.$emit("totop"):this.virtual.isBehind()&&e+t+this.bottomThreshold>=i&&this.$emit("tobottom")},getRenderSlots:function(e){for(var t=[],i=this.range,n=i.start,a=i.end,s=this.dataSources,r=this.dataKey,o=this.itemClass,l=this.itemTag,c=this.itemStyle,h=this.isHorizontal,u=this.extraProps,d=this.dataComponent,f=n;f<=a;f++){var p=s[f];p?Object.prototype.hasOwnProperty.call(p,r)?t.push(e(F,{props:{index:f,tag:l,event:P.ITEM,horizontal:h,uniqueKey:p[r],source:p,extraProps:u,component:d},style:c,class:"".concat(o).concat(this.itemClassAdd?" "+this.itemClassAdd(f):"")})):console.warn("Cannot get the data-key '".concat(r,"' from data-sources.")):console.warn("Cannot get the index '".concat(f,"' from data-sources."))}return t}},render:function(e){var t=this.$slots,i=t.header,n=t.footer,a=this.range,s=a.padFront,r=a.padBehind,o=this.isHorizontal,l=this.pageMode,c=this.rootTag,h=this.wrapTag,u=this.wrapClass,d=this.wrapStyle,f=this.headerTag,p=this.headerClass,m=this.headerStyle,g=this.footerTag,v=this.footerClass,y=this.footerStyle,z={padding:o?"0px ".concat(r,"px 0px ").concat(s,"px"):"".concat(s,"px 0px ").concat(r,"px")},b=d?Object.assign({},d,z):z;return e(c,{ref:"root",on:{"&scroll":!l&&this.onScroll}},[i?e(R,{class:p,style:m,props:{tag:f,event:P.SLOT,uniqueKey:j.HEADER}},i):null,e(h,{class:u,attrs:{role:"group"},style:b},this.getRenderSlots(e)),n?e(R,{class:v,style:y,props:{tag:g,event:P.SLOT,uniqueKey:j.FOOTER}},n):null,e("div",{ref:"shepherd",style:{width:o?"0px":"100%",height:o?"100%":"0px"}})])}}),H=M,D=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"introduction",domProps:{innerHTML:e._s(e.description)}})},$=[],B={name:"introduction",props:{description:{type:String}}},N=B,q=(i("de3a"),Object(r["a"])(N,D,$,!1,null,"0c507b69",null)),V=q.exports,A=function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.code?i("pre",{class:e.type,domProps:{innerHTML:e._s(e.encode(e.code))}}):e._e()},L=[],K=(i("ac1f"),i("5319"),{name:"code-high-light",props:{type:{type:String,required:!0},code:{type:String,required:!0}},mounted:function(){"undefined"!==typeof window.hljs&&this.$el.textContent&&window.hljs.highlightBlock(this.$el)},methods:{encode:function(e){return"html"===this.type&&(e=e.replace(//g,">")),e=e.replace(/\s/,""),e}}}),W=K,U=(i("595a"),Object(r["a"])(W,A,L,!1,null,"99fd125a",null)),G=U.exports,X=function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.isMobile?e._e():i("a",{staticClass:"github-corner",attrs:{href:e.url,"aria-label":"View source on GitHub"}},[e._v(" GITHUB ")])},Y=[],J=i("835c"),Q=i("3f05"),Z={name:"github-corner",data:function(){return{url:"",size:80,isMobile:J["a"]}},mounted:function(){this.url=Object(Q["a"])()}},ee=Z,te=(i("8388"),Object(r["a"])(ee,X,Y,!1,null,"4799d028",null)),ie=te.exports,ne=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"tab"},[i("div",{staticClass:"tab-item view",class:{active:e.isView},on:{click:e.eventClickView}},[e._v("VIEW")]),i("div",{staticClass:"tab-item code",class:{active:!e.isView},on:{click:e.eventClickCode}},[e._v("CODE")]),i("a",{directives:[{name:"show",rawName:"v-show",value:!e.isView,expression:"!isView"}],staticClass:"complete-code-url",attrs:{target:"_blank",href:e.completeCodeUrl}},[e._v("COMPLETE CODE")])])},ae=[],se=i("b95e"),re={name:"tab",data:function(){return{completeCodeUrl:"",active:se["a"]}},computed:{isView:function(){return this.active===se["b"].VIEW}},mounted:function(){this.completeCodeUrl=Object(Q["a"])()},methods:{eventClickView:function(){this.active=se["b"].VIEW,this.emitEvent()},eventClickCode:function(){this.active=se["b"].CODE,this.emitEvent()},emitEvent:function(){this.$emit("tab-change",this.active)}}},oe=re,le=(i("2345"),Object(r["a"])(oe,ne,ae,!1,null,"13711752",null)),ce=le.exports;n["a"].component("virtual-list",H),n["a"].component(V.name,V),n["a"].component(G.name,G),n["a"].component(ie.name,ie),n["a"].component(ce.name,ce),n["a"].component("github-button",b["a"]),n["a"].config.devtools=!1,n["a"].config.productionTip=!1,new n["a"]({router:z,render:function(e){return e(c)}}).$mount("#app")},"595a":function(e,t,i){"use strict";var n=i("a5ff"),a=i.n(n);a.a},"67ef":function(e,t,i){},"7c55":function(e,t,i){"use strict";var n=i("2395"),a=i.n(n);a.a},"835c":function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));i("ac1f"),i("466d");var n=navigator.userAgent,a=!!n.match(/Android/i),s=!!n.match(/iPhone|iPad|iPod/i),r=a||s},8388:function(e,t,i){"use strict";var n=i("b6af"),a=i.n(n);a.a},a5ff:function(e,t,i){},b6af:function(e,t,i){},b95e:function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return a}));var n={VIEW:1,CODE:2},a=n.VIEW},de3a:function(e,t,i){"use strict";var n=i("2f31"),a=i.n(n);a.a}}); \ No newline at end of file +(function(e){function t(t){for(var n,a,o=t[0],l=t[1],c=t[2],u=0,h=[];uthis.range.start)){var t=Math.max(e-this.param.buffer,0);this.checkRange(t,this.getEndByStart(t))}}},{key:"handleBehind",value:function(){var e=this.getScrollOvers();ee&&(a=i-1)}return t>0?--t:0}},{key:"getIndexOffset",value:function(e){if(!e)return 0;for(var t=0,i=0,n=0;n=this.dataSources.length-1)this.scrollToBottom();else{var t=this.virtual.getOffset(e);this.scrollToOffset(t)}},scrollToBottom:function(){var e=this,t=this.$refs.shepherd;if(t){var i=t[this.isHorizontal?"offsetLeft":"offsetTop"];this.scrollToOffset(i),setTimeout((function(){e.getOffset()+e.getClientSize()n||!n||(this.virtual.handleScroll(t),this.emitEvent(t,i,n,e))},emitEvent:function(e,t,i,n){this.$emit("scroll",n,this.virtual.getRange()),this.virtual.isFront()&&this.dataSources.length&&e-this.topThreshold<=0?this.$emit("totop"):this.virtual.isBehind()&&e+t+this.bottomThreshold>=i&&this.$emit("tobottom")},getRenderSlots:function(e){for(var t=[],i=this.range,n=i.start,a=i.end,s=this.dataSources,r=this.dataKey,o=this.itemClass,l=this.itemTag,c=this.itemStyle,u=this.isHorizontal,h=this.extraProps,d=this.dataComponent,f=n;f<=a;f++){var p=s[f];p?Object.prototype.hasOwnProperty.call(p,r)?t.push(e(F,{props:{index:f,tag:l,event:P.ITEM,horizontal:u,uniqueKey:p[r],source:p,extraProps:h,component:d},style:c,class:"".concat(o).concat(this.itemClassAdd?" "+this.itemClassAdd(f):"")})):console.warn("Cannot get the data-key '".concat(r,"' from data-sources.")):console.warn("Cannot get the index '".concat(f,"' from data-sources."))}return t}},render:function(e){var t=this.$slots,i=t.header,n=t.footer,a=this.range,s=a.padFront,r=a.padBehind,o=this.isHorizontal,l=this.pageMode,c=this.rootTag,u=this.wrapTag,h=this.wrapClass,d=this.wrapStyle,f=this.headerTag,p=this.headerClass,m=this.headerStyle,g=this.footerTag,v=this.footerClass,y=this.footerStyle,z={padding:o?"0px ".concat(r,"px 0px ").concat(s,"px"):"".concat(s,"px 0px ").concat(r,"px")},b=d?Object.assign({},d,z):z;return e(c,{ref:"root",on:{"&scroll":!l&&this.onScroll}},[i?e(R,{class:p,style:m,props:{tag:f,event:P.SLOT,uniqueKey:M.HEADER}},i):null,e(u,{class:h,attrs:{role:"group"},style:b},this.getRenderSlots(e)),n?e(R,{class:v,style:y,props:{tag:g,event:P.SLOT,uniqueKey:M.FOOTER}},n):null,e("div",{ref:"shepherd",style:{width:o?"0px":"100%",height:o?"100%":"0px"}})])}}),D=j,H=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"introduction",domProps:{innerHTML:e._s(e.description)}})},B=[],$={name:"introduction",props:{description:{type:String}}},N=$,q=(i("de3a"),Object(r["a"])(N,H,B,!1,null,"0c507b69",null)),V=q.exports,A=function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.code?i("pre",{class:e.type,domProps:{innerHTML:e._s(e.encode(e.code))}}):e._e()},L=[],K=(i("ac1f"),i("5319"),{name:"code-high-light",props:{type:{type:String,required:!0},code:{type:String,required:!0}},mounted:function(){"undefined"!==typeof window.hljs&&this.$el.textContent&&window.hljs.highlightBlock(this.$el)},methods:{encode:function(e){return"html"===this.type&&(e=e.replace(//g,">")),e=e.replace(/\s/,""),e}}}),W=K,U=(i("595a"),Object(r["a"])(W,A,L,!1,null,"99fd125a",null)),X=U.exports,G=function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.isMobile?e._e():i("a",{staticClass:"github-corner",attrs:{href:e.url,"aria-label":"View source on GitHub"}},[e._v(" GITHUB ")])},Y=[],J=i("835c"),Q=i("3f05"),Z={name:"github-corner",data:function(){return{url:"",size:80,isMobile:J["a"]}},mounted:function(){this.url=Object(Q["a"])()}},ee=Z,te=(i("8388"),Object(r["a"])(ee,G,Y,!1,null,"4799d028",null)),ie=te.exports,ne=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"tab"},[i("div",{staticClass:"tab-item view",class:{active:e.isView},on:{click:e.eventClickView}},[e._v("VIEW")]),i("div",{staticClass:"tab-item code",class:{active:!e.isView},on:{click:e.eventClickCode}},[e._v("CODE")]),i("a",{directives:[{name:"show",rawName:"v-show",value:!e.isView,expression:"!isView"}],staticClass:"complete-code-url",attrs:{target:"_blank",href:e.completeCodeUrl}},[e._v("COMPLETE CODE")])])},ae=[],se=i("b95e"),re={name:"tab",data:function(){return{completeCodeUrl:"",active:se["a"]}},computed:{isView:function(){return this.active===se["b"].VIEW}},mounted:function(){this.completeCodeUrl=Object(Q["a"])()},methods:{eventClickView:function(){this.active=se["b"].VIEW,this.emitEvent()},eventClickCode:function(){this.active=se["b"].CODE,this.emitEvent()},emitEvent:function(){this.$emit("tab-change",this.active)}}},oe=re,le=(i("2345"),Object(r["a"])(oe,ne,ae,!1,null,"13711752",null)),ce=le.exports;n["a"].component("virtual-list",D),n["a"].component(V.name,V),n["a"].component(X.name,X),n["a"].component(ie.name,ie),n["a"].component(ce.name,ce),n["a"].component("github-button",b["a"]),n["a"].config.devtools=!1,n["a"].config.productionTip=!1,new n["a"]({router:z,render:function(e){return e(c)}}).$mount("#app")},"595a":function(e,t,i){"use strict";var n=i("a5ff"),a=i.n(n);a.a},"67ef":function(e,t,i){},"7c55":function(e,t,i){"use strict";var n=i("2395"),a=i.n(n);a.a},"835c":function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));i("ac1f"),i("466d");var n=navigator.userAgent,a=!!n.match(/Android/i),s=!!n.match(/iPhone|iPad|iPod/i),r=a||s},8388:function(e,t,i){"use strict";var n=i("b6af"),a=i.n(n);a.a},a5ff:function(e,t,i){},b6af:function(e,t,i){},b95e:function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return a}));var n={VIEW:1,CODE:2},a=n.VIEW},de3a:function(e,t,i){"use strict";var n=i("2f31"),a=i.n(n);a.a}}); \ No newline at end of file diff --git a/example/src/App.vue b/example/src/App.vue index af7e1c3..0acf040 100644 --- a/example/src/App.vue +++ b/example/src/App.vue @@ -105,6 +105,7 @@ h1, h2, h3, h4, h5, h6 { .example-content { margin-top: 1em; background-color: #fff; + position: relative; } .scroll-touch {