Files
2023-11-14 17:21:03 +08:00

2 lines
1.4 KiB
JavaScript

import{f as e,G as p,o as a,c as t,w as r,j as s,n as o,A as l,d as i}from"./index-3714412c.js";import{_ as n}from"./_plugin-vue_export-helper.1b428a4d.js";const c=n({__name:"space",props:["direction","align","wrap","justify","size","height","padding","flex","border"],setup(n){const c=n,g=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}`),g.value=p})(c),d(c)})),(e,p)=>{const n=i;return a(),t(n,{class:o(g.value),style:l([d])},{default:r((()=>[s(e.$slots,"default",{},void 0,!0)])),_:3},8,["class","style"])}}},[["__scopeId","data-v-b96ea372"]]);export{c as _};