1 |
- import{d as s,_ as o,am as d,c as e}from"./index.83786b38.js";const h="_sticky_4d2w6_1",f="_white_4d2w6_6";var i={sticky:h,white:f},l=s({emits:["getHeight"],name:"o-sticky",props:{position:{type:String,default:"top"},background:{type:String,default:""},mode:{type:String,default:"fixed"},offsetTop:{type:String,default:"0px"},offsetBottom:{default:"0px"}},data(){return{divStyle:{},sectionStyle:{width:"100%",height:"auto",left:"0"}}},mounted(){this.position==="top"?this.divStyle.top=this.offsetTop||"0px":this.divStyle.bottom=this.offsetBottom||"0px",o(()=>{setTimeout(()=>{const{height:t}=d(this.$refs.div);this.sectionStyle.height=`${t}px`,this.$emit("getHeight",t)},200)})},watch:{offsetTop(){this.divStyle.top=this.offsetTop},offsetBottom(){this.divStyle.bottom=this.offsetBottom}},render(){return e("div",{style:[this.sectionStyle],class:this.mode==="sticky"&&i.sticky},[e("div",{ref:"div",class:["van-sticky",this.mode==="fixed"?"van-sticky--fixed":"",i[this.background]],style:[this.divStyle,this.sectionStyle]},[this.$slots.default&&this.$slots.default()])])}});export{l as O};
|