1 |
- import{d as c,p as e,b as g,i as n,F as d}from"./index.7994470a.js";import{N as p}from"./index.0a2aeb2c.js";const u="_colHeader_a7v8p_1",H="_transparent_a7v8p_11",v="_headerSection_a7v8p_14";var s={colHeader:u,transparent:H,headerSection:v},f=c({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"}});let 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 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{f as C};
|