1 |
- import{t as P,v as b,z as m,w as k,d as v,x as _,c as i,U as f,bh as q,D as p,N as z,ae as D,C as E,af as O,y as x,bi as T,E as V,aL as $,a5 as w}from"./index.332c7f08.js";const[h,L]=P("grid"),U={square:Boolean,center:b,border:b,gutter:m,reverse:Boolean,iconSize:m,direction:String,clickable:Boolean,columnNum:k(4)},S=Symbol(h);var j=v({name:h,props:U,setup(e,{slots:t}){const{linkChildren:o}=_(S);return o({props:e}),()=>{var c;return i("div",{style:{paddingLeft:f(e.gutter)},class:[L(),{[q]:e.border&&!e.gutter}]},[(c=t.default)==null?void 0:c.call(t)])}}});const H=p(j),[K,l]=P("grid-item"),Y=z({},D,{dot:Boolean,text:String,icon:String,badge:m,iconColor:String,iconPrefix:String,badgeProps:Object});var A=v({name:K,props:Y,setup(e,{slots:t}){const{parent:o,index:c}=E(S),y=O();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}]),{[T]: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};
|