jiku-ui
Version:
A Component Library for Vue.js.
1 lines • 3.5 kB
JavaScript
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},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="",n(n.s=138)}({0:function(t,e,n){"use strict";function r(t,e,n,r,o,i,l,s){var c,a="function"==typeof t?t.options:t;if(e&&(a.render=e,a.staticRenderFns=n,a._compiled=!0),r&&(a.functional=!0),i&&(a._scopeId="data-v-"+i),l?(c=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(l)},a._ssrRegister=c):o&&(c=s?function(){o.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(a.functional){a._injectStyles=c;var u=a.render;a.render=function(t,e){return c.call(e),u(t,e)}}else{var f=a.beforeCreate;a.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:a}}n.d(e,"a",(function(){return r}))},138:function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"hn-fade-in"}},[t.visible?n("div",{staticClass:"hn-backtop",style:{right:t.styleRight,bottom:t.styleBottom},on:{click:function(e){return e.stopPropagation(),t.handleClick(e)}}},[t._t("default",[n("hn-icon",{attrs:{name:"caret-top"}})])],2):t._e()])};r._withStripped=!0;var o=n(27),i=n.n(o),l={name:"HnBacktop",props:{visibilityHeight:{type:Number,default:200},target:[String],right:{type:Number,default:40},bottom:{type:Number,default:40}},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.visible=t>=this.visibilityHeight},handleClick:function(t){this.scrollToTop(),this.$emit("click",t)},scrollToTop:function(){var t=this.el,e=0,n=setInterval((function(){t.scrollTop<=0?clearInterval(n):(e+=10,t.scrollTop-=e)}),20)}},beforeDestroy:function(){this.container.removeEventListener("scroll",this.throttledScrollHandler)}},s=n(0),c=Object(s.a)(l,r,[],!1,null,null,null);c.options.__file="packages/backtop/src/main.vue";var a=c.exports;a.install=function(t){t.component(a.name,a)};e.default=a},27:function(t,e){t.exports=require("throttle-debounce/throttle")}}).default;