UNPKG

vue-go-back-top

Version:
1 lines 10.7 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-go-back-top",[],t):"object"==typeof exports?exports["vue-go-back-top"]=t():e["vue-go-back-top"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s="lVK7")}({"FZ+f":function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"});return[n].concat(i).concat([r]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<e.length;r++){var a=e[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},Ohvw:function(e,t,n){(e.exports=n("FZ+f")(!0)).push([e.i,"\n.global-goto-top[data-v-3034e104] {\r\n position: fixed;\r\n right: 10px;\r\n bottom: 42px;\r\n z-index: 999;\n}\n.global-goto-top span[data-v-3034e104] {\r\n background: url(data:image/png;base64,iVBORw0KGgoAAA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73M3gTnb9WzHyj8/7HHiMMZ+hESpnlBOkL6AWL3v9N0jqX+AAAAAElFTkSuQmCC)\r\n no-repeat;\r\n width: 40px;\r\n height: 40px;\r\n background-size: 40px auto;\n}\n.global-goto-top span.show[data-v-3034e104] {\r\n display: block;\n}\n.global-goto-top span.hide[data-v-3034e104] {\r\n display: none;\n}\r\n","",{version:3,sources:["D:/My Document/vue-go-back-top/src/components/goTop.vue"],names:[],mappings:";AACA;EACE,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,aAAa;CACd;AACD;IACI;gBACY;IACZ,YAAY;IACZ,aAAa;IACb,2BAA2B;CAC9B;AACD;IACI,eAAe;CAClB;AACD;IACI,cAAc;CACjB",file:"goTop.vue",sourcesContent:["\n.global-goto-top[data-v-3034e104] {\r\n position: fixed;\r\n right: 10px;\r\n bottom: 42px;\r\n z-index: 999;\n}\n.global-goto-top span[data-v-3034e104] {\r\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAABSCAMAAADw8nOpAAAAllBMVEUAAADr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+v29vaZmZnz8/Pr6+vw8PDt7e3p6em0tLSkpKSdnZ3Jycmjo6Ompqbc3NzBwcGtra1dbEnwAAAAInRSTlMAC094R531uIIVAnbp3NfRmIh7cmwzp767lJBfXKjthkkqC81vPQAAAlpJREFUWMPF2WlzgjAQBuBwKoqI9ehlr3Q3tMVq+///XJlMMxmHEjawTt8Z/eQ8gsRNshF9yeLN7U2Rp5g+LpY3t5s4E2MShHdLrJQCkDoASlW4vAuDYd4s3jUcyFagYXfxzP8C51hZrs1WOA/8wCkq2ROFUw80sqAbjYhgONEgCZ2EFHGFIMkBXPWC20RJr6hk6xb3CNIzgHuXuDain7nuFq+M6GtedYqVHJiqw1wbcYj5573fIwwnAe/b4laLI8z2WEpAjgokrf+MkiOjVudiiHJ0MDwjJzCehMlZNVOSISqyYoCSJWhr8lTxkGrauki+y5wrLlLNf2dXlGzBmSbjznJxqF//Tn3oKh+xJnfQRVqxZXaNzQfzcFiu0j6gsJKMqcKGLIGThLIhF7zkQogMiZ890b4aMzuE3MHj6xFJP+YzsQi9fTTP+QNp5SgBokg0IRHXQBOpJlyLAkiiMd96yULkNPFdvyhmLlKaCM0bkMxUYJ/4qUXZvEuSiSKliZokmSgeaaImSWYqFhTRkBQzF0sgiIY05me3CYVzqB+tqElrHl1DPXGQtRYtac26m0ycZeP0/QWyRUr4+j45ygahuFmSWNwy5CUxMxPFeNJOFKLkJUsz6XKQdtINkIu0a7cH0p3X52PRuYAhDqNDfaDcd3yBxSD7kjW6zMKaf/nPv0nh30rxb/j4t6X8m2f+LT5/I4K/XcLf1Ll068kmGtggc7VGNwhDxI272ah8RYV74cxLWXmK5Yvoy5Nf4/aJv73M3gTnb9WzHyj8/7HHiMMZ+hESpnlBOkL6AWL3v9N0jqX+AAAAAElFTkSuQmCC)\r\n no-repeat;\r\n width: 40px;\r\n height: 40px;\r\n background-size: 40px auto;\n}\n.global-goto-top span.show[data-v-3034e104] {\r\n display: block;\n}\n.global-goto-top span.hide[data-v-3034e104] {\r\n display: none;\n}\r\n"],sourceRoot:""}])},"VU/8":function(e,t){e.exports=function(e,t,n,o,r,i){var a,s=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(a=e,s=e.default);var c,u="function"==typeof s?s.options:s;if(t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),n&&(u.functional=!0),r&&(u._scopeId=r),i?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},u._ssrRegister=c):o&&(c=o),c){var d=u.functional,p=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(e,t){return c.call(t),p(e,t)}):u.beforeCreate=p?[].concat(p,c):[c]}return{esModule:a,exports:s,options:u}}},lVK7:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={name:"vue-go-back-top",data:function(){return{isShow:!1,isAutoScroll:!1}},methods:{getScrollTop:function(){var e=0;return document.documentElement&&document.documentElement.scrollTop?e=document.documentElement.scrollTop:document.body&&(e=document.body.scrollTop),parseFloat(e)},setScrollTop:function(e){document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop=e:document.body&&(document.body.scrollTop=e)},getClientHeight:function(){var e=0;if(document.body.clientHeight&&document.documentElement.clientHeight)e=document.body.clientHeight<document.documentElement.clientHeight?document.body.clientHeight:document.documentElement.clientHeight;else e=document.body.clientHeight>document.documentElement.clientHeight?document.body.clientHeight:document.documentElement.clientHeight;return parseFloat(e)},handleClick:function(){var e=this;this.isShow=!1,this.isAutoScroll=!0,clearInterval(t);var t=setInterval(function(){var n=e.getScrollTop(),o=Math.floor((0-n)/5);0==n&&(clearInterval(t),e.isAutoScroll=!1),e.setScrollTop(n+o)},30)},handleScroll:function(){!this.isShow&&!this.isAutoScroll&&1*this.getClientHeight()<this.getScrollTop()&&(this.isShow=!0),this.isShow&&1*this.getClientHeight()>this.getScrollTop()&&(this.isShow=!1)}},mounted:function(){window.addEventListener("scroll",this.handleScroll)},destoryed:function(){window.removeEventListener("scroll",this.handleScroll)}},r={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"global-goto-top",on:{click:this.handleClick}},[t("span",{class:this.isShow?"show":"hide"})])},staticRenderFns:[]};var i=n("VU/8")(o,r,!1,function(e){n("vL/5")},"data-v-3034e104",null).exports;n.d(t,"GoTop",function(){return i}),i.install=function(e){e.component(i.name,i)};var a=[i];"undefined"!=typeof window&&window.Vue&&function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.forEach(function(t){e.component(t.name,t)})}(window.Vue);t.default=i},rjj0:function(e,t,n){var o="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!o)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 r=n("tTVk"),i={},a=o&&(document.head||document.getElementsByTagName("head")[0]),s=null,l=0,c=!1,u=function(){},d=null,p="data-vue-ssr-id",v="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function f(e){for(var t=0;t<e.length;t++){var n=e[t],o=i[n.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](n.parts[r]);for(;r<n.parts.length;r++)o.parts.push(A(n.parts[r]));o.parts.length>n.parts.length&&(o.parts.length=n.parts.length)}else{var a=[];for(r=0;r<n.parts.length;r++)a.push(A(n.parts[r]));i[n.id]={id:n.id,refs:1,parts:a}}}}function h(){var e=document.createElement("style");return e.type="text/css",a.appendChild(e),e}function A(e){var t,n,o=document.querySelector("style["+p+'~="'+e.id+'"]');if(o){if(c)return u;o.parentNode.removeChild(o)}if(v){var r=l++;o=s||(s=h()),t=b.bind(null,o,r,!1),n=b.bind(null,o,r,!0)}else o=h(),t=function(e,t){var n=t.css,o=t.media,r=t.sourceMap;o&&e.setAttribute("media",o);d.ssrId&&e.setAttribute(p,t.id);r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,o),n=function(){o.parentNode.removeChild(o)};return t(e),function(o){if(o){if(o.css===e.css&&o.media===e.media&&o.sourceMap===e.sourceMap)return;t(e=o)}else n()}}e.exports=function(e,t,n,o){c=n,d=o||{};var a=r(e,t);return f(a),function(t){for(var n=[],o=0;o<a.length;o++){var s=a[o];(l=i[s.id]).refs--,n.push(l)}t?f(a=r(e,t)):a=[];for(o=0;o<n.length;o++){var l;if(0===(l=n[o]).refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete i[l.id]}}}};var g,m=(g=[],function(e,t){return g[e]=t,g.filter(Boolean).join("\n")});function b(e,t,n,o){var r=n?"":o.css;if(e.styleSheet)e.styleSheet.cssText=m(t,r);else{var i=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}},tTVk:function(e,t){e.exports=function(e,t){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],a=i[0],s={id:e+":"+r,css:i[1],media:i[2],sourceMap:i[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}},"vL/5":function(e,t,n){var o=n("Ohvw");"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals);n("rjj0")("3f905df2",o,!0,{})}})});