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