m2-ui
Version:
The package is provided web components and utilities based on vue and element-ui.
6 lines • 4.48 kB
JavaScript
/*!
* m2-ui v1.0.0
* (c) 2020 by Miracle He
* Released under the MIT License.
*/
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=24)}({0:function(t,e,n){"use strict";function o(t,e,n,o,r,i,s,c){var u,a="function"==typeof t?t.options:t;if(e&&(a.render=e,a.staticRenderFns=n,a._compiled=!0),o&&(a.functional=!0),i&&(a._scopeId="data-v-"+i),s?(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(s)},a._ssrRegister=u):r&&(u=c?function(){r.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:r),u)if(a.functional){a._injectStyles=u;var l=a.render;a.render=function(t,e){return u.call(e),l(t,e)}}else{var f=a.beforeCreate;a.beforeCreate=f?[].concat(f,u):[u]}return{exports:t,options:a}}n.d(e,"a",(function(){return o}))},2:function(t,e,n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.a={hasOwn:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},isListened:function(t,e){return t._events[e]&&"object"===r(t._events[e])},getClientHeight:function(){return document.documentElement.clientHeight},getScrollTop:function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop},setScrollTop:function(t){document.documentElement.scrollTop=document.body.scrollTop=t},getMapItem:function(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return r.reduce((function(n,r){var i;return o({},n,((i={})[r]=t[e[r]]||t[r],i))}),{})},oneOf:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.some((function(e){return e===t}));return n}}},24:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{directives:[{name:"show",rawName:"v-show",value:this.visible,expression:"visible"}],staticClass:"m2-back-top",class:this.customClass,on:{click:this.backTop}},[this._t("default",[e("span",{staticClass:"back-icon",style:this.iconStyle})])],2)};o._withStripped=!0;var r=n(2),i={name:"m2-back-top",props:{icon:String,customClass:String},data:function(){return{visible:!1,timer:null,isTop:!0}},computed:{iconStyle:function(){return this.icon?{"background-image":"url("+this.icon+")"}:null},isNative:function(){return r.a.isListened(this,"back")}},mounted:function(){this.load()},destroyed:function(){this.clearTimer()},methods:{show:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.visible=t},load:function(){var t=this;this.isNative||this.$nextTick((function(){var e=r.a.getClientHeight();window.addEventListener("scroll",(function(){var n=r.a.getScrollTop();t.visible=n>=e,!t.isTop&&t.clearTimer(),t.isTop=!1}))}))},backTop:function(){var t=this;this.isNative?this.$emit("back"):this.timer=setInterval((function(){var e=r.a.getScrollTop(),n=Math.floor(-e/6);r.a.setScrollTop(e+n),t.isTop=!0,0===e&&t.clearTimer()}),30)},clearTimer:function(){this.timer&&clearInterval(this.timer)}}},s=n(0),c=Object(s.a)(i,o,[],!1,null,null,null);c.options.__file="packages/back-top/src/main.vue";var u=c.exports;u.install=function(t){t.component(u.name,u)};e.default=u}});