uni-row.FyV3igX2.js 2.3 KB

1
  1. import{_ as t,i as e,j as s,k as a,R as r,G as u,L as i,x as n}from"./index-cgJbsk9Q.js";const l="uni-col";const p=t({name:"uniCol",props:{span:{type:Number,default:24},offset:{type:Number,default:-1},pull:{type:Number,default:-1},push:{type:Number,default:-1},xs:[Number,Object],sm:[Number,Object],md:[Number,Object],lg:[Number,Object],xl:[Number,Object]},data:()=>({gutter:0,sizeClass:"",parentWidth:0,nvueWidth:0,marginLeft:0,right:0,left:0}),created(){let t=this.$parent;for(;t&&"uniRow"!==t.$options.componentName;)t=t.$parent;this.updateGutter(t.gutter),t.$watch("gutter",t=>{this.updateGutter(t)})},computed:{sizeList(){let{span:t,offset:e,pull:s,push:a}=this;return{span:t,offset:e,pull:s,push:a}},pointClassList(){let t=[];return["xs","sm","md","lg","xl"].forEach(e=>{const s=this[e];"number"==typeof s?t.push(`${l}-${e}-${s}`):"object"==typeof s&&s&&Object.keys(s).forEach(a=>{t.push("span"===a?`${l}-${e}-${s[a]}`:`${l}-${e}-${a}-${s[a]}`)})}),t.join(" ")}},methods:{updateGutter(t){t=Number(t),isNaN(t)||(this.gutter=t/2)}},watch:{sizeList:{immediate:!0,handler(t){let e=[];for(let s in t){const a=t[s];!a&&0!==a||-1===a||e.push("span"===s?`${l}-${a}`:`${l}-${s}-${a}`)}this.sizeClass=e.join(" ")}}}},[["render",function(t,l,p,o,f,d){const m=n;return e(),s(m,{class:u(["uni-col",f.sizeClass,d.pointClassList]),style:i({paddingLeft:`${Number(f.gutter)}rpx`,paddingRight:`${Number(f.gutter)}rpx`})},{default:a(()=>[r(t.$slots,"default",{},void 0,!0)]),_:3},8,["class","style"])}],["__scopeId","data-v-84ac5f6d"]]),o="uni-row",f="--";const d=t({name:"uniRow",componentName:"uniRow",props:{type:String,gutter:Number,justify:{type:String,default:"start"},align:{type:String,default:"top"},width:{type:[String,Number],default:750}},created(){},computed:{marginValue(){return this.gutter?-this.gutter/2:0},typeClass(){return"flex"===this.type?`${o+f}flex`:""},justifyClass(){return"start"!==this.justify?`${o+f}flex-justify-${this.justify}`:""},alignClass(){return"top"!==this.align?`${o+f}flex-align-${this.align}`:""}}},[["render",function(t,l,p,o,f,d){const m=n;return e(),s(m,{class:u(["uni-row",d.typeClass,d.justifyClass,d.alignClass]),style:i({marginLeft:`${Number(d.marginValue)}rpx`,marginRight:`${Number(d.marginValue)}rpx`})},{default:a(()=>[r(t.$slots,"default",{},void 0,!0)]),_:3},8,["class","style"])}],["__scopeId","data-v-9ff25b7f"]]);export{p as _,d as a};