@xysfe/actui
Version:
A fantastic mobile ui lib implement by Vue
1 lines • 3.57 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Sticky=e():t.Sticky=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="../lib",e(e.s=1811)}({1:function(t,e,n){"use strict";function o(t,e,n,o,i,r,s,c){t=t||{};var u=typeof t.default;"object"!==u&&"function"!==u||(t=t.default);var f="function"==typeof t?t.options:t;e&&(f.render=e,f.staticRenderFns=n,f._compiled=!0),o&&(f.functional=!0),r&&(f._scopeId=r);var l;if(s?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},f._ssrRegister=l):i&&(l=c?function(){i.call(this,this.$root.$options.shadowRoot)}:i),l)if(f.functional){f._injectStyles=l;var a=f.render;f.render=function(t,e){return l.call(e),a(t,e)}}else{var d=f.beforeCreate;f.beforeCreate=d?[].concat(d,l):[l]}return{exports:t,options:f}}e.a=o},1300:function(t,e,n){"use strict";var o=n(1369);e.a={name:"ActSticky",props:{offsetTop:{type:[Number,String],default:0},zIndex:{type:[Number,String],default:""}},data:function(){return{height:0,fixed:!1}},computed:{containerStyle:function(){var t={};return this.fixed&&this.height&&(t.height=this.height+"px"),t},stickyStyle:function(){if(this.fixed){var t={};return this.zIndex&&(t.zIndex=this.zIndex),this.offsetTop&&this.fixed&&(t.top=this.offsetTop+"px"),t}}},mounted:function(){this.scroller=window,window.addEventListener("scroll",this.onScroll,!0),this.onScroll()},watch:{value:function(t){t!==this.currentValue&&(this.currentValue=this.format(t))},currentValue:function(t){this.$emit("input",t)}},methods:{onScroll:function(){this.height=this.$el.offsetHeight;var t=+this.offsetTop,e=Object(o.b)(window),n=Object(o.a)(this.$el);this.fixed=e+t>n,this.$emit("scroll",{scrollTop:e,isFixed:this.fixed})}},beforeDestroy:function(){window.removeEventListener("scroll",this.onScroll,!0)}}},1367:function(t,e,n){"use strict";function o(t){c||n(1368)}var i=n(1300),r=n(1370),s=n(1),c=!1,u=o,f=Object(s.a)(i.a,r.a,r.b,!1,u,"data-v-70e26592",null);f.options.__file="src\\components\\Sticky\\src\\index.vue",e.a=f.exports},1368:function(t,e){},1369:function(t,e,n){"use strict";function o(t){return"scrollTop"in t?t.scrollTop:t.pageYOffset}function i(t){return s(t)?0:t.getBoundingClientRect().top+r()}function r(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function s(t){return t===window}e.b=o,e.a=i},1370:function(t,e,n){"use strict";n.d(e,"a",function(){return o}),n.d(e,"b",function(){return i});var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{style:t.containerStyle},[n("div",{class:{"sticky-fixed":t.fixed},style:t.stickyStyle},[t._t("default")],2)])},i=[];o._withStripped=!0},1811:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1367);o.a.install=function(t){t.component(o.a.name,o.a)},e.default=o.a}})});