vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
39 lines (38 loc) • 858 B
JavaScript
import { computed as a } from "vue";
const o = (t, n) => {
const r = a(() => {
if (!t)
return {};
const c = {
left: "start",
center: "center",
right: "end"
}, l = {
top: "start",
middle: "center",
bottom: "end"
}, e = {
gridTemplateRows: t.rows + "px",
gridTemplateColumns: `repeat(${t.columns}, 1fr)`,
gap: t.gap + "px",
justifyItems: c[t.justify],
alignContent: l[t.align]
};
return t.rowGap && Object.assign(e, {
rowGap: t.rowGap + "px"
}), t.columnGap && Object.assign(e, {
columnGap: t.columnGap + "px"
}), e;
}), i = a(() => n ? {
gridRow: `span ${n.row} / span ${n.row}`,
gridColumn: `span ${n.column} / span 1`,
height: n.height
} : {});
return {
gridStyles: r,
style: i
};
};
export {
o as useGrid
};