UNPKG

3.71 kBJavaScriptView Raw
1module.exports=function(t){function e(n){if(o[n])return o[n].exports;var s=o[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var o={};return e.m=t,e.c=o,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=319)}({0:function(t,e){t.exports=function(t,e,o,n,s,i){var r,l=t=t||{},c=typeof t.default;"object"!==c&&"function"!==c||(r=t,l=t.default);var d="function"==typeof l?l.options:l;e&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0),o&&(d.functional=!0),s&&(d._scopeId=s);var a;if(i?(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__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},d._ssrRegister=a):n&&(a=n),a){var u=d.functional,f=u?d.render:d.beforeCreate;u?(d._injectStyles=a,d.render=function(t,e){return a.call(e),f(t,e)}):d.beforeCreate=f?[].concat(f,a):[a]}return{esModule:r,exports:l,options:d}}},112:function(t,e,o){"use strict";e.a={name:"Sticky",componentName:"Sticky",props:{fixedTop:{type:String}},mounted:function(){var t=this;this.supportSticky()||this.$nextTick(function(){t.$$scrollNode=t.getScrollNode(t.$el.offsetParent),t.$$scrollNode&&(t.$$childNode=t.$el.querySelector(".vx-sticky--inner"),t.$$scrollNode.addEventListener("touchstart",t.handleTouchStart,!1),t.$$scrollNode.addEventListener("scroll",t.handleScroll,!1),window.addEventListener("resize",t.handleResize,!1))})},methods:{supportSticky:function(){if(void 0!==this.$$supportSticky)return this.$$supportSticky;var t=document.createElement("div");return t.style.cssText="position:-webkit-sticky;position:sticky;",this.$$supportSticky=(t.style.cssText||"").indexOf("sticky")>-1,this.$$supportSticky},handleResize:function(){this.handleTouchStart(),this.handleScroll()},handleTouchStart:function(){this.$el.style.height=this.$$childNode.offsetHeight+"px",this.$myData={offsetTop:this.$el.offsetTop,fixedTop:this.fixedTop||this.$$scrollNode.offsetTop+"px"}},handleScroll:function(t){t&&void 0===t.touchstart&&this.handleTouchStart(),this.$$scrollNode.scrollTop>this.$myData.offsetTop?(this.$el.classList.add("is-fixed"),this.$$childNode.style.top!==this.$myData.fixedTop&&(this.$$childNode.style.top=this.$myData.fixedTop)):(this.$el.classList.remove("is-fixed"),this.$$childNode.style.top="")},getScrollNode:function(t){var e=t;return document.body===e?e=window:function t(){var o=window.getComputedStyle(e);["scroll","auto"].indexOf(o.overflow)>-1||["scroll","auto"].indexOf(o["overflow-y"])>-1||"touch"===o["-webkit-overflow-scrolling"]||"touch"===o["overflow-scrolling"]||(e=e.offsetParent,e===document.body?e=window:e&&t())}(),e}},beforeDestroy:function(){this.$$scrollNode&&(this.$$scrollNode.removeEventListener("scroll",this.handleScroll),this.$$scrollNode.removeEventListener("touchstart",this.handleTouchStart),window.removeEventListener("resize",this.handleResize))}}},212:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(112),s=o(213),i=o(0),r=i(n.a,s.a,!1,null,null,null);e.default=r.exports},213:function(t,e,o){"use strict";var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"vx-sticky--box",style:"top:"+(t.fixedTop||"0px")},[o("div",{staticClass:"vx-sticky--inner"},[t._t("default")],2)])},s=[],i={render:n,staticRenderFns:s};e.a=i},319:function(t,e,o){t.exports=o(212)}});
\No newline at end of file