1 |
- import{t as P,v as b,z as m,w as k,d as v,x as T,c as i,U as f,bl as _,D as p,N as q,ae as z,C as D,af as E,y as x,bm as O,E as V,aT as $,a5 as w}from"./index.5f7ffb46.js";const[S,U]=P("grid"),j={square:Boolean,center:b,border:b,gutter:m,reverse:Boolean,iconSize:m,direction:String,clickable:Boolean,columnNum:k(4)},h=Symbol(S);var K=v({name:S,props:j,setup(e,{slots:t}){const{linkChildren:o}=T(h);return o({props:e}),()=>{var c;return i("div",{style:{paddingLeft:f(e.gutter)},class:[U(),{[_]:e.border&&!e.gutter}]},[(c=t.default)==null?void 0:c.call(t)])}}});const H=p(K),[L,l]=P("grid-item"),Y=q({},z,{dot:Boolean,text:String,icon:String,badge:m,iconColor:String,iconPrefix:String,badgeProps:Object});var A=v({name:L,props:Y,setup(e,{slots:t}){const{parent:o,index:c}=D(h),y=E();if(!o){console.error("[Vant] <GridItem> must be a child component of <Grid>.");return}const B=x(()=>{const{square:s,gutter:n,columnNum:r}=o.props,d=`${100/+r}%`,a={flexBasis:d};if(s)a.paddingTop=d;else if(n){const u=f(n);a.paddingRight=u,c.value>=+r&&(a.marginTop=u)}return a}),C=x(()=>{const{square:s,gutter:n}=o.props;if(s&&n){const r=f(n);return{right:r,bottom:r,height:"auto"}}}),I=()=>{if(t.icon)return i($,V({dot:e.dot,content:e.badge},e.badgeProps),{default:t.icon});if(e.icon)return i(w,{dot:e.dot,name:e.icon,size:o.props.iconSize,badge:e.badge,class:l("icon"),color:e.iconColor,badgeProps:e.badgeProps,classPrefix:e.iconPrefix},null)},R=()=>{if(t.text)return t.text();if(e.text)return i("span",{class:l("text")},[e.text])},G=()=>t.default?t.default():[I(),R()];return()=>{const{center:s,border:n,square:r,gutter:d,reverse:a,direction:u,clickable:g}=o.props,N=[l("content",[u,{center:s,square:r,reverse:a,clickable:g,surround:n&&d}]),{[O]:n}];return i("div",{class:[l({square:r})],style:B.value},[i("div",{role:g?"button":void 0,class:N,style:C.value,tabindex:g?0:void 0,onClick:y},[G()])])}}});const J=p(A);export{H as G,J as a};
|