UNPKG

gepic

Version:

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

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