epic-designer-gold
Version:
基于vue3的设计器,可视化开发页面表单
48 lines (47 loc) • 1.43 kB
JavaScript
import { defineComponent as p, h as d } from "vue";
import { ElMessage as f } from "element-plus";
const g = p({
props: {
componentSchema: {
type: Object,
required: !0,
default: () => ({})
},
modelValue: {
type: String,
default: () => ""
}
},
setup(e, { attrs: u, slots: k }) {
return () => {
var i, n;
const t = {
...e.componentSchema
// header: props.componentSchema?.label ?? "",
};
delete t.children;
function s() {
var o, l, r;
(o = t == null ? void 0 : t.componentProps) != null && o.isLink && ((l = t == null ? void 0 : t.componentProps) != null && l.link ? window.open((r = t == null ? void 0 : t.componentProps) == null ? void 0 : r.link, "blank") : f.warning("链接地址为空,无法跳转"));
}
return d(
"div",
{
...t,
...t.componentProps,
onClick: s,
class: (i = t == null ? void 0 : t.componentProps) != null && i.dynamic ? "gold-text-link" : "",
style: {
textAlign: t.position,
fontSize: t.fontSize + "px"
}
},
// 如果使用动态文字的话,就根据field显示对应文字,否则就是直接显示文本
(n = t == null ? void 0 : t.componentProps) != null && n.dynamic ? e.modelValue : t.label
);
};
}
});
export {
g as default
};