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:
parent
d4e5621743
commit
fee37b267a
@ -66,6 +66,11 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
code: dedent`
|
||||
/**
|
||||
* 以下代码中的方法会被注入到最终的代码中,如果命名与源代码有相同的,则会替换源代码
|
||||
* 内部集成了axios,开发者可以直接通过axios发起网络请求,不过接口需要允许跨域。
|
||||
* axios官方文档:https://www.npmjs.com/package/axios
|
||||
*/
|
||||
{
|
||||
props: [],
|
||||
components: {},
|
||||
|
@ -1,13 +1,6 @@
|
||||
<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;">
|
||||
@ -49,7 +42,8 @@ export default {
|
||||
},
|
||||
onSave() {
|
||||
const code = this.$refs.codeEditor.getEditorCode();
|
||||
const JSCodeInfo = eval(`(function(){return ${code}})()`);
|
||||
const temp = code.replace(/.+\*\/\s*/gs, "");
|
||||
const JSCodeInfo = eval(`(function(){return ${temp}})()`);
|
||||
console.info(JSCodeInfo.methods.request.toString());
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user