1 |
- import{p as e,d as l}from"./index.f45ba589.js";import{d as g,b as n,F as d,N as p}from"./vendor.2bcdc9cf.js";const u="_colHeader_9vc6f_1",H="_transparent_9vc6f_11",v="_headerSection_9vc6f_14";var s={colHeader:u,transparent:H,headerSection:v},k=g({name:"col-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:()=>{}}},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(){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"},c=>{const{content:i}=c,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()}),!l().isApp&&t&&t()},onClickLeft(){this.$router.back()},clickRight(){this.onClickRight&&this.onClickRight()}},render(){return n("div",null,[this.$slots.content?n("div",{style:{paddingTop:`${this.navBarHeight}px`,background:this.background},class:s.headerSection},[this.$slots.content(this.navBarHeight)]):n(d,null,[n("div",{style:{minHeight:`calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`},class:s.headerSection},[n(p,{title:this.headerTitle,class:[s.colHeader],style:{background:this.background,color:this.color,paddingTop:`${this.navBarHeight}px`,zIndex:99},"left-arrow":this.isBack,rightText:this.rightText,fixed:this.isFixed,border:this.border,"onClick-right":this.clickRight,"onClick-left":this.onClickLeft},{right:()=>this.$slots.right&&this.$slots.right()||this.rightText})]),this.$slots.default?this.$slots.default():null])])}});export{k as C};
|