UNPKG

element-gui

Version:

A Component Library for Vue.js.

1 lines 3.83 kB
module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=135)}({0:function(t,e,n){"use strict";function o(t,e,n,o,r,i,l,s){var u,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),o&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),l?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(l)},c._ssrRegister=u):r&&(u=s?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),u)if(c.functional){c._injectStyles=u;var a=c.render;c.render=function(t,e){return u.call(e),a(t,e)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,u):[u]}return{exports:t,options:c}}n.d(e,"a",(function(){return o}))},135:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-fade-in"}},[t.visible?n("div",{class:["el-backtop",t.effect?"el-backtop--"+t.effect:"",{"is-square":t.square}],style:{right:t.styleRight,bottom:t.styleBottom},on:{click:function(e){return e.stopPropagation(),t.handleClick(e)}}},[t._t("default",[n("el-icon",{attrs:{name:"topping"}})])],2):t._e()])};o._withStripped=!0;var r=n(23),i=n.n(r),l=function(t){return Math.pow(t,3)},s={name:"ElBacktop",props:{visibilityHeight:{type:Number,default:200},target:[String],right:{type:Number,default:40},bottom:{type:Number,default:40},effect:{type:String,default:"light"},square:{type:Boolean,default:!1}},data:function(){return{el:null,container:null,visible:!1}},computed:{styleBottom:function(){return this.bottom+"px"},styleRight:function(){return this.right+"px"}},mounted:function(){this.init(),this.throttledScrollHandler=i()(300,this.onScroll),this.container.addEventListener("scroll",this.throttledScrollHandler)},methods:{init:function(){if(this.container=document,this.el=document.documentElement,this.target){if(this.el=document.querySelector(this.target),!this.el)throw new Error("target is not existed: "+this.target);this.container=this.el}},onScroll:function(){var t=this.el.scrollTop;this.target||t||(document.documentElement.scrollTop?this.el=document.documentElement:this.el=document.body),this.visible=t>=this.visibilityHeight},handleClick:function(t){this.scrollToTop(),this.$emit("click",t)},scrollToTop:function(){var t=this.el,e=Date.now(),n=t.scrollTop,o=window.requestAnimationFrame||function(t){return setTimeout(t,16)};o((function r(){var i,s=(Date.now()-e)/500;s<1?(t.scrollTop=n*(1-((i=s)<.5?l(2*i)/2:1-l(2*(1-i))/2)),o(r)):t.scrollTop=0}))}},beforeDestroy:function(){this.container.removeEventListener("scroll",this.throttledScrollHandler)}},u=n(0),c=Object(u.a)(s,o,[],!1,null,null,null).exports;c.install=function(t){t.component(c.name,c)};e.default=c},23:function(t,e){t.exports=require("throttle-debounce/throttle")}});