lc-vue-grid-layout-wrapper
Version:
39 lines (38 loc) • 1.04 kB
JavaScript
import { defineComponent as p, createVNode as s, resolveComponent as n, isVNode as c } from "vue";
function i(o) {
return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !c(o);
}
const a = /* @__PURE__ */ p({
props: {
col: {
type: Number,
default: 2
}
},
render() {
if (this.$slots.default) {
const o = this.$slots.default().filter((t) => typeof t.type != "symbol"), r = [];
for (let t = 0; t < Math.ceil(o.length / this.col); t++)
for (let e = 0; e < this.col; e++) {
const l = t * this.col + e;
o[l] && (r[t] = r[t] || [], r[t][e] = o[l]);
}
return r.map((t) => {
let e;
return s(n("el-row"), {
gutter: 24
}, i(e = t.map((l) => s(n("el-col"), {
span: 24 / this.col
}, i(l) ? l : {
default: () => [l]
}))) ? e : {
default: () => [e]
});
});
}
return s("div", null, null);
}
});
export {
a as GridLayoutWrapper
};