Files
2024-02-22 18:37:23 +08:00

2 lines
1.4 KiB
JavaScript

import{a as e,v as p,o as a,j as t,w as r,a0 as s,m as o,y as l,B as i}from"./index-d4baa715.js";import{_ as g}from"./_plugin-vue_export-helper.1b428a4d.js";const n=g({__name:"space",props:["direction","align","wrap","justify","size","height","padding","flex","border"],setup(g){const n=g,c=e({}),d=({size:e=6,wrap:p,height:a,padding:t,flex:r})=>{let s={};if(a&&(s.height=`${a}rpx`),"number"==typeof e&&(s.gap=e+"px"),p&&(s.flexWrap="wrap"),"string"==typeof e)switch(e){case"small":s.gap="8rpx";break;case"middle":s.gap="16rpx";break;case"large":s.gap="24rpx"}return"string"==typeof t&&(s.padding=`${t}rpx`),"[object Array]"===Object.prototype.toString.call(t)&&"object"==typeof t&&(1==t.length&&(s.padding=`${t[0]}rpx`),2==t.length&&(s.padding=`${t[0]}rpx ${t[1]}rpx`)),"[object Array]"===Object.prototype.toString.call(e)&&"object"==typeof e&&(1==e.length&&(s.gap=`${e[0]}rpx`),2==e.length&&(s.gap=`${e[0]}rpx ${e[1]}rpx`)),r&&(s.flex=r),s};return p((()=>{(e=>{let p="yshop-space",a=e.direction,t=e.align,r=e.wrap,s=e.justify;e.flex,e.border&&(p+=" yshop-space-border"),a&&(p+=` yshop-space-${a}`),r&&(p+=` yshop-space-${r}`),t&&(p+=` yshop-space-align-${t}`),s&&(p+=` yshop-space-justify-${s}`),e.gap&&(p+=" gap"),c.value=p})(n),d(n)})),(e,p)=>{const g=i;return a(),t(g,{class:o(c.value),style:l([d])},{default:r((()=>[s(e.$slots,"default",{},void 0,!0)])),_:3},8,["class","style"])}}},[["__scopeId","data-v-8142571b"]]);export{n as _};