index-legacy.5d9f864a.js 2.0 KB

1
  1. !function(){var t=document.createElement("style");t.innerHTML="._white_1n1t5_1{background-color:#fff}._white_1n1t5_1 ._pad_1n1t5_4{padding:.4rem;box-shadow:0 0 .26667rem rgba(216,216,216,.5)}._sticky_1n1t5_8{position:sticky;top:0;z-index:99}._white-only_1n1t5_13{background-color:#fff}\n",document.head.appendChild(t),System.register(["./ResizeObserver.es-legacy.44b91b4c.js","./index-legacy.4bad5b90.js"],(function(t){"use strict";var e,i,o;return{setters:[function(t){e=t.d,i=t.j},function(t){o=t.u}],execute:function(){var s={white:"_white_1n1t5_1",pad:"_pad_1n1t5_4",sticky:"_sticky_1n1t5_8","white-only":"_white-only_1n1t5_13"};t("C",e({name:"col-sticky",props:{position:{type:String,default:"top"},background:{type:String,default:""},mode:{type:String,default:"fixed"},offsetTop:{type:String,default:"0px"},offsetBottom:{default:"0px"},varName:{type:String,default:"--header-height"}},emits:["getHeight"],data:function(){return{divStyle:{},heightV:0,sectionStyle:{width:"100%",height:"auto"}}},mounted:function(){var t=this;"top"===this.position?this.divStyle.top=this.offsetTop||"0px":this.divStyle.bottom=this.offsetBottom||"0px";try{o(this.$refs.div2,(function(e){var i=e[0].contentRect.height;Math.abs(i-t.heightV)>1&&setTimeout((function(){t.__initHeight(i)}),10)}))}catch(e){console.log(e,"error useResizeObserver")}},methods:{__initHeight:function(t){this.sectionStyle.height="".concat(t,"px"),this.heightV=t,document.documentElement.style.setProperty(this.varName,"".concat(t,"px")),this.$emit("getHeight",t)}},watch:{offsetTop:function(){this.divStyle.top=this.offsetTop},offsetBottom:function(){this.divStyle.bottom=this.offsetBottom}},render:function(){return i("div",{style:[this.sectionStyle],class:"sticky"===this.mode&&s.sticky},[i("div",{ref:"div",class:["van-sticky","fixed"===this.mode?"van-sticky--fixed":"",s[this.background]],style:[this.divStyle,this.sectionStyle]},[i("div",{ref:"div2"},[i("div",{class:s.pad},[this.$slots.default&&this.$slots.default()])])])])}}))}}}))}();