mirror of
https://github.com/sahadev/vue-component-creater-ui.git
synced 2025-06-07 13:44:06 +08:00
支持了以文本转换为对象,再将对象转换为文本
This commit is contained in:
parent
10d53105fc
commit
d4e5621743
@ -66,10 +66,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
code: dedent`
|
||||
// 以下代码中的方法会被注入到最终的代码中,如果命名与源代码有相同的,则会替换源代码
|
||||
// 内部集成了axios,开发者可以直接通过axios发起网络请求,不过接口需要允许跨域。
|
||||
// axios官方文档:https://www.npmjs.com/package/axios
|
||||
export default {
|
||||
{
|
||||
props: [],
|
||||
components: {},
|
||||
|
||||
|
@ -1,11 +1,19 @@
|
||||
<template>
|
||||
<el-dialog title="JS逻辑编辑" :visible.sync="codeDialogVisible" width="70%" top="10vh" :before-close="handleClose"
|
||||
:center=true>
|
||||
<div style="font-size:12px; margin-top:5px;">
|
||||
// 以下代码中的方法会被注入到最终的代码中,如果命名与源代码有相同的,则会替换源代码</div>
|
||||
<div style="font-size:12px; margin-top:5px;">
|
||||
// 内部集成了axios,开发者可以直接通过axios发起网络请求,不过接口需要允许跨域。</div>
|
||||
<div style="font-size:12px; margin-top:5px;">
|
||||
// axios官方文档:https://www.npmjs.com/package/axios</div>
|
||||
|
||||
<CodeEditor ref="codeEditor"></CodeEditor>
|
||||
|
||||
<div style="text-align:center;padding: 10px;">
|
||||
<el-button type="primary" @click="onSave">确认修改</el-button>
|
||||
<div style="color: #f5222d; font-size:12px; margin-top:5px;">Tips: 确认修改之后将会影响最终生成的代码逻辑</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@ -41,7 +49,8 @@ export default {
|
||||
},
|
||||
onSave() {
|
||||
const code = this.$refs.codeEditor.getEditorCode();
|
||||
debugger
|
||||
const JSCodeInfo = eval(`(function(){return ${code}})()`);
|
||||
console.info(JSCodeInfo.methods.request.toString());
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user