UNPKG

gepic

Version:

基于vue3的设计器,可视化开发页面表单

61 lines (60 loc) 1.88 kB
import { defineComponent as v, ref as s, inject as x, createBlock as _, openBlock as C, unref as c, withCtx as E, createElementVNode as k, createVNode as w } from "vue"; import { pluginManager as u } from "../../../../../../utils/manager/pluginManager.js"; import "@vueuse/core"; import "../../../../../../hooks/store/index.js"; const O = { class: "min-w-750px rounded h-full" }, M = /* @__PURE__ */ v({ __name: "previewJson", setup(V, { expose: d }) { const m = u.getComponent("modal"), f = u.getComponent("monacoEditor"), p = { theme: "vs-light", selectOnLineNumbers: !0, minimap: { enabled: !1 }, readOnly: !0 }, o = s(null), e = s(!1), l = x("pageSchema"); function g() { e.value = !1; } function r() { e.value = !0, o.value ? o.value.setValue(JSON.stringify(l, null, 2)) : setTimeout(() => { r(); }, 300); } function h(i = "epic-data.json") { const t = JSON.stringify(l, null, 2); var n = `data:text/json;charset=utf-8,${encodeURIComponent(t)}`, a = document.createElement("a"); a.setAttribute("href", n), a.setAttribute("download", i), a.click(); } return d({ handleOpen: r }), (i, t) => (C(), _(c(m), { modelValue: e.value, "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value = n), title: "查看数据", class: "w-900px", width: "900px", "ok-text": "导出数据", onClose: g, onOk: h }, { default: E(() => [ k("div", O, [ w(c(f), { ref_key: "monacoEditorRef", ref: o, class: "editor h-full", "auto-toggle-theme": "", "read-only": "", config: p, language: "json" }, null, 512) ]) ]), _: 1 }, 8, ["modelValue"])); } }); export { M as default };