mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
2.8 KiB
JavaScript
2 lines
2.8 KiB
JavaScript
import{c as C,v as A,a as I}from"./use-translate.d2900b8c.js";import{n as S,t as F,w as E}from"./with-install.19a35764.js";import{H as d,f as R}from"./constant.80c6de18.js";import{u as N}from"./use-placeholder.7306f9cf.js";import{I as D,a as P}from"./index.b70c9b40.js";import{z as g,C as z,e as r,r as L,o as y,a as O,w as s,B as e,F as U}from"./vue-libs.b44bc779.js";import{T as x}from"./function-call.509e41a7.js";import"./use-height.f6deaa0a.js";import"./on-popup-reopen.138c77eb.js";import"./mount-component.f3744995.js";import"./use-expose.c942d5f8.js";import"./index.e6e790ed.js";import"./interceptor.f0c85874.js";import"./use-touch.04ca7093.js";import"./use-lazy-render.f712e85e.js";import"./index.d46e53a8.js";import"./index.4e4daaac.js";const[V,n]=C("nav-bar"),H={title:String,fixed:Boolean,zIndex:S,border:F,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean},K=g({name:V,props:H,emits:["click-left","click-right"],setup(a,{emit:t,slots:l}){const i=z(),u=N(i,n),m=c=>t("click-left",c),o=c=>t("click-right",c),B=()=>l.left?l.left():[a.leftArrow&&r(D,{class:n("arrow"),name:"arrow-left"},null),a.leftText&&r("span",{class:n("text")},[a.leftText])],k=()=>l.right?l.right():r("span",{class:n("text")},[a.rightText]),h=()=>{const{title:c,fixed:p,border:_,zIndex:v}=a,w=A(v),T=a.leftArrow||a.leftText||l.left,b=a.rightText||l.right;return r("div",{ref:i,style:w,class:[n({fixed:p}),{[R]:_,"van-safe-area-top":a.safeAreaInsetTop}]},[r("div",{class:n("content")},[T&&r("div",{class:[n("left"),d],onClick:m},[B()]),r("div",{class:[n("title"),"van-ellipsis"]},[l.title?l.title():c]),b&&r("div",{class:[n("right"),d],onClick:o},[k()])])])};return()=>a.fixed&&a.placeholder?u(h):h()}}),M=E(K),f=M,it=g({__name:"index",setup(a){const t=I({"zh-CN":{useSlot:"\u4F7F\u7528\u63D2\u69FD",showBack:"\u8FD4\u56DE\u4E0A\u7EA7",rightButton:"\u53F3\u4FA7\u6309\u94AE"},"en-US":{useSlot:"Use Slot",showBack:"Back",rightButton:"Right Button"}}),l=()=>x(t("back")),i=()=>x(t("button"));return(u,m)=>{const o=L("demo-block");return y(),O(U,null,[r(o,{title:e(t)("basicUsage")},{default:s(()=>[r(e(f),{title:e(t)("title")},null,8,["title"])]),_:1},8,["title"]),r(o,{title:e(t)("showBack")},{default:s(()=>[r(e(f),{title:e(t)("title"),"left-text":e(t)("back"),"left-arrow":"",onClickRight:i},null,8,["title","left-text"])]),_:1},8,["title"]),r(o,{title:e(t)("rightButton")},{default:s(()=>[r(e(f),{title:e(t)("title"),"left-text":e(t)("back"),"right-text":e(t)("button"),"left-arrow":"",onClickLeft:l,onClickRight:i},null,8,["title","left-text","right-text"])]),_:1},8,["title"]),r(o,{title:e(t)("useSlot")},{default:s(()=>[r(e(f),{title:e(t)("title"),"left-text":e(t)("back"),"left-arrow":""},{right:s(()=>[r(e(P),{name:"search",size:"18"})]),_:1},8,["title","left-text"])]),_:1},8,["title"])],64)}}});export{it as default};
|