@xysfe/actui
Version:
A fantastic mobile ui lib implement by Vue
1 lines • 3.5 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@xysfe/actui/es/assets/utils/position.js")):"function"==typeof define&&define.amd?define(["@xysfe/actui/es/assets/utils/position.js"],e):"object"==typeof exports?exports.Sticky=e(require("@xysfe/actui/es/assets/utils/position.js")):t.Sticky=e(t["@xysfe/actui/es/assets/utils/position.js"])}("undefined"!=typeof self?self:this,function(t){return function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},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="../es",e(e.s=1622)}({1622:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(940);i.a.install=function(t){t.component(i.a.name,i.a)},e.default=i.a},7:function(t,e,n){"use strict";function i(t,e,n,i,o,s,r,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),i&&(f.functional=!0),s&&(f._scopeId=s);var a;if(r?(a=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},f._ssrRegister=a):o&&(a=c?function(){o.call(this,this.$root.$options.shadowRoot)}:o),a)if(f.functional){f._injectStyles=a;var l=f.render;f.render=function(t,e){return a.call(e),l(t,e)}}else{var d=f.beforeCreate;f.beforeCreate=d?[].concat(d,a):[a]}return{exports:t,options:f}}e.a=i},872:function(t,e,n){"use strict";var i=n(942);n.n(i);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(i.getScrollTop)(window),n=Object(i.getElementTop)(this.$el);this.fixed=e+t>n,this.$emit("scroll",{scrollTop:e,isFixed:this.fixed})}},beforeDestroy:function(){window.removeEventListener("scroll",this.onScroll,!0)}}},940:function(t,e,n){"use strict";function i(t){c||n(941)}var o=n(872),s=n(943),r=n(7),c=!1,u=i,f=Object(r.a)(o.a,s.a,s.b,!1,u,"data-v-70e26592",null);f.options.__file="src\\components\\Sticky\\src\\index.vue",e.a=f.exports},941:function(t,e){},942:function(e,n){e.exports=t},943:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"b",function(){return o});var i=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)])},o=[];i._withStripped=!0}})});