|
|
@ -27,8 +27,7 @@ export default { |
|
|
|
fApi:{}, |
|
|
|
fApi:{}, |
|
|
|
formData:{}, |
|
|
|
formData:{}, |
|
|
|
formConfig: ` |
|
|
|
formConfig: ` |
|
|
|
/* eslint-disable */ |
|
|
|
const codeVueLast = ` |
|
|
|
let codeVueLast = ` |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
@ -38,36 +37,37 @@ let codeVueLast = ` |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
<\/script>`; |
|
|
|
<\/script>` |
|
|
|
// |
|
|
|
// |
|
|
|
const state = reactive({ |
|
|
|
const state = reactive({ |
|
|
|
open: false, |
|
|
|
open: false, |
|
|
|
jsonData: {} as IFormConfig, |
|
|
|
jsonData: {} as IFormConfig, |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const showModal = (formConfig: IFormConfig) => { |
|
|
|
function showModal(formConfig: IFormConfig) { |
|
|
|
formConfig.schemas && formatRules(formConfig.schemas); |
|
|
|
formConfig.schemas && formatRules(formConfig.schemas) |
|
|
|
state.open = true; |
|
|
|
state.open = true |
|
|
|
state.jsonData = formConfig; |
|
|
|
state.jsonData = formConfig |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const editorVueJson = computed(() => { |
|
|
|
const editorVueJson = computed(() => { |
|
|
|
return codeVueFront + JSON.stringify(removeAttrs(state.jsonData), null, '\t') + codeVueLast; |
|
|
|
return codeVueFront + JSON.stringify(removeAttrs(state.jsonData), null, '\t') + codeVueLast |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ showModal }) |
|
|
|
defineExpose({ showModal }) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<Modal |
|
|
|
<Modal |
|
|
|
title="代码" |
|
|
|
title="代码" |
|
|
|
:footer="null" |
|
|
|
:footer="null" |
|
|
|
:open="state.open" |
|
|
|
:open="state.open" |
|
|
|
@cancel="state.open = false" |
|
|
|
wrap-class-name="v-code-modal" |
|
|
|
wrapClassName="v-code-modal" |
|
|
|
|
|
|
|
style="top: 20px" |
|
|
|
style="top: 20px" |
|
|
|
width="850px" |
|
|
|
width="850px" |
|
|
|
:destroyOnClose="true" |
|
|
|
:destroy-on-close="true" |
|
|
|
|
|
|
|
@cancel="state.open = false" |
|
|
|
> |
|
|
|
> |
|
|
|
<PreviewCode :editorJson="editorVueJson" fileFormat="vue" /> |
|
|
|
<PreviewCode :editor-json="editorVueJson" file-format="vue" /> |
|
|
|
</Modal> |
|
|
|
</Modal> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|