UNPKG

primevue

Version:

PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc

2 lines (1 loc) 1.3 kB
this.primevue=this.primevue||{},this.primevue.deferredcontent=function(e,t,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"DeferredContent",extends:o(e).default,inheritAttrs:!1,emits:["load"],style:o(t).default,data:function(){return{loaded:!1}},mounted:function(){this.loaded||(this.shouldLoad()?this.load():this.bindScrollListener())},beforeUnmount:function(){this.unbindScrollListener()},methods:{bindScrollListener:function(){var e=this;this.documentScrollListener=function(){e.shouldLoad()&&(e.load(),e.unbindScrollListener())},window.addEventListener("scroll",this.documentScrollListener)},unbindScrollListener:function(){this.documentScrollListener&&(window.removeEventListener("scroll",this.documentScrollListener),this.documentScrollListener=null)},shouldLoad:function(){if(this.loaded)return!1;var e=this.$refs.container.getBoundingClientRect();return document.documentElement.clientHeight>=e.top},load:function(e){this.loaded=!0,this.$emit("load",e)}}};return i.render=function(e,t,o,i,r,d){return n.openBlock(),n.createElementBlock("div",n.mergeProps({ref:"container"},e.ptmi("root")),[r.loaded?n.renderSlot(e.$slots,"default",{key:0}):n.createCommentVNode("",!0)],16)},i}(primevue.basecomponent,primevue.deferredcontent.style,Vue);