gepic
Version:
基于vue3的设计器,可视化开发页面表单
74 lines (73 loc) • 2.08 kB
JavaScript
import { defineComponent as V, computed as g, createElementBlock as l, openBlock as a, createElementVNode as p, Fragment as k, renderList as C, createVNode as m, createCommentVNode as y, unref as c } from "vue";
import { pluginManager as U } from "../../../utils/manager/pluginManager.js";
import "@vueuse/core";
import "../../../hooks/store/index.js";
import { getUUID as P } from "../../../utils/common/string.js";
import b from "../../components/icon/src/icon.vue.js";
const E = {
key: 0,
class: "epic-del-btn"
}, N = ["onClick"], $ = /* @__PURE__ */ V({
__name: "index",
props: {
modelValue: {
type: Array,
default: () => []
}
},
emits: ["update:modelValue"],
setup(s, { emit: u }) {
const d = U.getComponent("number"), i = s, v = u, n = g({
get() {
return i.modelValue;
},
set(e) {
v("update:modelValue", e);
}
});
function f() {
const e = {
type: "col",
children: [],
componentProps: {
span: 12
},
id: P()
};
n.value.push(e);
}
function _(e) {
n.value = n.value.filter((h, o) => e !== o);
}
return (e, h) => (a(), l("div", null, [
(a(!0), l(k, null, C(n.value, (o, r) => (a(), l("div", {
key: r,
class: "EColEditor-item"
}, [
m(c(d), {
value: o.componentProps.span,
"onUpdate:value": (t) => o.componentProps.span = t,
modelValue: o.componentProps.span,
"onUpdate:modelValue": (t) => o.componentProps.span = t,
style: { width: "100%" },
min: 1,
max: 24
}, null, 8, ["value", "onUpdate:value", "modelValue", "onUpdate:modelValue"]),
n.value.length > 1 ? (a(), l("div", E, [
p("span", {
onClick: (t) => _(r)
}, [
m(c(b), { name: "icon-shanchu1" })
], 8, N)
])) : y("", !0)
]))), 128)),
p("div", {
class: "add-btn",
onClick: f
}, " 添加 ")
]));
}
});
export {
$ as default
};