1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2025-06-07 21:54:05 +08:00

支持了以文本转换为对象,再将对象转换为文本

This commit is contained in:
shangbin 2021-09-09 19:14:48 +08:00
parent 10d53105fc
commit d4e5621743
2 changed files with 11 additions and 5 deletions

View File

@ -66,10 +66,7 @@ export default {
data() { data() {
return { return {
code: dedent` code: dedent`
// {
// axiosaxios
// axioshttps://www.npmjs.com/package/axios
export default {
props: [], props: [],
components: {}, components: {},

View File

@ -1,11 +1,19 @@
<template> <template>
<el-dialog title="JS逻辑编辑" :visible.sync="codeDialogVisible" width="70%" top="10vh" :before-close="handleClose" <el-dialog title="JS逻辑编辑" :visible.sync="codeDialogVisible" width="70%" top="10vh" :before-close="handleClose"
:center=true> :center=true>
<div style="font-size:12px; margin-top:5px;">
// </div>
<div style="font-size:12px; margin-top:5px;">
// axiosaxios</div>
<div style="font-size:12px; margin-top:5px;">
// axioshttps://www.npmjs.com/package/axios</div>
<CodeEditor ref="codeEditor"></CodeEditor> <CodeEditor ref="codeEditor"></CodeEditor>
<div style="text-align:center;padding: 10px;"> <div style="text-align:center;padding: 10px;">
<el-button type="primary" @click="onSave">确认修改</el-button> <el-button type="primary" @click="onSave">确认修改</el-button>
<div style="color: #f5222d; font-size:12px; margin-top:5px;">Tips: 确认修改之后将会影响最终生成的代码逻辑</div> <div style="color: #f5222d; font-size:12px; margin-top:5px;">Tips: 确认修改之后将会影响最终生成的代码逻辑</div>
</div> </div>
</el-dialog> </el-dialog>
@ -41,7 +49,8 @@ export default {
}, },
onSave() { onSave() {
const code = this.$refs.codeEditor.getEditorCode(); const code = this.$refs.codeEditor.getEditorCode();
debugger const JSCodeInfo = eval(`(function(){return ${code}})()`);
console.info(JSCodeInfo.methods.request.toString());
} }
}, },
watch: { watch: {