UNPKG

arco-crud-plus

Version:

基于arco-design-vue的配置化表格表单组件

49 lines (48 loc) 1.39 kB
import { defineComponent as x, computed as C, getCurrentInstance as E, ref as s, onMounted as j, openBlock as y, createBlock as _, unref as v, normalizeClass as M, normalizeStyle as k } from "vue"; import { getPrefixCls as J } from "@arco-design/web-vue/es/_utils/global-config"; import R from "json-editor-vue"; const H = /* @__PURE__ */ x({ name: "AJsonEditor", __name: "index", props: { mode: { default: "text" }, height: {}, maxHeight: { default: "" } }, emits: ["onChange", "onError", "onChangeMode"], setup(a, { expose: i, emit: d }) { const m = a, o = d, l = J("json-editor"), c = C(() => [l]), f = E(), t = s(), n = s(); j(() => { f && (n.value = t.value.jsonEditor); }); const u = (e) => { o("onError", e); }, p = (e, r, g) => { if (e.text) { try { e.json = JSON.parse(e.text); } catch { } e.text = void 0; } o("onChange", e.json, r, g); }, h = (e) => { o("onChangeMode", e); }; return i({ jsonEditor: n }), (e, r) => (y(), _(v(R), { ref_key: "jsonEditorVueRef", ref: t, class: M(c.value), mode: e.mode, onError: u, onChange: p, onChangeMode: h, style: k({ "max-height": m.maxHeight, "overflow-y": "auto" }) }, null, 8, ["class", "mode", "style"])); } }); export { H as default };