index.a0ef77e4.js 2.5 KB

1
  1. import{d as c,k as e,e as g,c as s,F as d}from"./index.ffe80dbe.js";import{N as u}from"./index.1d5c6f70.js";const p="_colHeader_b3raa_1",H="_transparent_b3raa_15",b="_headerSection_b3raa_18";var n={colHeader:p,transparent:H,headerSection:b},v=c({name:"o-header",props:{title:String,isBack:{type:Boolean,default:!1},backIconColor:{type:String,default:"black"},isFixed:{type:Boolean,default:!0},styleName:{type:Object,default:()=>({})},titleClass:String,background:{type:String,default:"white"},color:{type:String,default:"#323233"},rightText:String,onClickRight:{type:Function,default:()=>{}},border:{type:Boolean,default:!0},onHeaderBack:{type:Function,default:()=>{}},desotry:{type:Boolean,default:!0}},watch:{backIconColor(){e({api:"backIconChange",content:{iconStyle:this.backIconColor}})}},data(){return{headerTitle:null,navBarHeight:0,titleHeight:44}},mounted(){this.headerTitle=this.title||this.$route.meta.title,this.navBarInit(()=>{this.onHeaderBack&&this.onHeaderBack()})},unmounted(){this.desotry&&(e({api:"setBarStatus",content:{status:1}}),e({api:"backIconChange",content:{iconStyle:"black"}}))},methods:{navBarInit(t){e({api:"setBarStatus",content:{status:0}}),e({api:"backIconChange",content:{iconStyle:this.backIconColor||"black"}});const o=sessionStorage.getItem("navHeight"),h=sessionStorage.getItem("titleHeight");o&&h?(this.navBarHeight=Number(o),t&&t()):e({api:"getNavHeight"},l=>{const{content:i}=l,r=i.dpi||2;if(i.navHeight){const a=i.navHeight/r;sessionStorage.setItem("navHeight",String(a)),this.navBarHeight=a}if(i.titleHeight){const a=i.titleHeight/r;sessionStorage.setItem("titleHeight",String(a)),this.titleHeight=a}t&&t()}),!g().isApp&&t&&t()},onClickLeft(){this.$router.back()},clickRight(){this.onClickRight&&this.onClickRight()}},render(){return s("div",null,[this.$slots.content?s("div",{style:{paddingTop:`${this.navBarHeight}px`,background:this.background},class:n.headerSection},[this.$slots.content(this.navBarHeight)]):s(d,null,[s("div",{style:{minHeight:`calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`},class:n.headerSection},[s(u,{title:this.headerTitle,class:[n.colHeader],style:{background:this.background,color:this.color,paddingTop:`${this.navBarHeight}px`},"left-arrow":this.isBack,rightText:this.rightText,fixed:this.isFixed,zIndex:2e3,border:this.border,onClickLeft:this.onClickLeft,onClickRight:this.clickRight},{right:()=>this.$slots.right&&this.$slots.right()||this.rightText,title:()=>this.$slots.title&&this.$slots.title()||this.headerTitle})]),this.$slots.default?this.$slots.default():null])])}});export{v as O};