1 |
- import{U as v,V as m,X as y,Y as I,j as i,E as $,G as R,H as _,d as k,ae as w,aU as u,aV as N,N as A,O as F,n as s,f,F as z}from"./ResizeObserver.es.39b48a47.js";const P=t=>{const a=v(),e=()=>{a.value=I(t).height};return m(()=>{y(e),setTimeout(e,100)}),a};function L(t,a){const e=P(t);return o=>i("div",{class:a("placeholder"),style:{height:e.value?`${e.value}px`:void 0}},[o()])}const[O,n]=$("nav-bar"),D={title:String,fixed:Boolean,zIndex:R,border:_,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean};var E=k({name:O,props:D,emits:["click-left","click-right"],setup(t,{emit:a,slots:e}){const o=v(),r=L(o,n),c=h=>a("click-left",h),l=h=>a("click-right",h),p=()=>e.left?e.left():[t.leftArrow&&i(A,{class:n("arrow"),name:"arrow-left"},null),t.leftText&&i("span",{class:n("text")},[t.leftText])],H=()=>e.right?e.right():i("span",{class:n("text")},[t.rightText]),g=()=>{const{title:h,fixed:x,border:B,zIndex:C}=t,S=w(C),T=t.leftArrow||t.leftText||e.left,b=t.rightText||e.right;return i("div",{ref:o,style:S,class:[n({fixed:x}),{[N]:B,"van-safe-area-top":t.safeAreaInsetTop}]},[i("div",{class:n("content")},[T&&i("div",{class:[n("left"),u],onClick:c},[p()]),i("div",{class:[n("title"),"van-ellipsis"]},[e.title?e.title():h]),b&&i("div",{class:[n("right"),u],onClick:l},[H()])])])};return()=>t.fixed&&t.placeholder?r(g):g()}});const q=F(E);const M="_colHeader_nq1uz_1",V="_transparent_nq1uz_20",j="_headerSection_nq1uz_23";var d={colHeader:M,transparent:V,headerSection:j},G=k({name:"col-header",props:{title:String,isBack:{type:Boolean,default:!0},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:"#131415"},rightText:String,onClickRight:{type:Function,default:()=>{}},border:{type:Boolean,default:!0},onHeaderBack:{type:Function,default:()=>{}},hideHeader:{type:Boolean,default:!1},leftClickDefault:{type:Boolean,default:!0}},emits:["leftClick"],watch:{backIconColor(){s({api:"backIconChange",content:{iconStyle:this.backIconColor}})},title(){this.headerTitle=this.title}},data(){return{headerTitle:null,navBarHeight:0,titleHeight:44}},mounted(){this.headerTitle=this.title||this.$route.meta.title,this.navBarInit(()=>{this.onHeaderBack&&this.onHeaderBack()})},unmounted(){s({api:"setBarStatus",content:{status:1}}),s({api:"backIconChange",content:{iconStyle:"black"}})},methods:{navBarInit(t){s({api:"setBarStatus",content:{status:0}}),s({api:"backIconChange",content:{iconStyle:this.backIconColor||"black"}});const a=sessionStorage.getItem("navHeight"),e=sessionStorage.getItem("titleHeight");a&&e?(this.navBarHeight=Number(a),t&&t()):s({api:"getNavHeight"},o=>{const{content:r}=o,c=r.dpi||2;if(r.navHeight){const l=r.navHeight/c;sessionStorage.setItem("navHeight",String(l)),this.navBarHeight=l}if(r.titleHeight){const l=r.titleHeight/c;sessionStorage.setItem("titleHeight",String(l)),this.titleHeight=l}t&&t()}),!f().isApp&&t&&t()},onClickLeft(){this.$emit("leftClick",null),s({api:"setStatusBarTextColor",content:{statusBarTextColor:!1}}),this.leftClickDefault&&(f().isApp?s({api:"goBack"}):this.$router.back())},clickRight(){this.onClickRight&&this.onClickRight()}},render(){return this.hideHeader?i("div",null,null):i("div",null,[this.$slots.content?i("div",{style:{paddingTop:`${this.navBarHeight}px`,background:this.background},class:d.headerSection},[this.$slots.content(this.navBarHeight)]):i(z,null,[i("div",{style:{minHeight:`calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`},class:d.headerSection},[i(q,{title:this.headerTitle,class:[d.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,title:()=>this.$slots.title&&this.$slots.title()||this.headerTitle})]),this.$slots.default?this.$slots.default():null])])}});export{G as C,q as N,P as u};
|