Skip to content

Commit a9c2590

Browse files
author
shangbin
committed
增加JS逻辑帮助入口
1 parent 0f97f9c commit a9c2590

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

src/components/JSCodeEditorDialog.vue

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
:center=true>
44
<CodeEditor style="max-height: 65vh;" ref="codeEditor" :initCode="code" mode="text/javascript"></CodeEditor>
55

6-
<div style="text-align:center;padding: 10px;">
7-
<el-button type="primary" @click="onSave">确认修改</el-button>
8-
<div style="color: #6c6c6c; font-size:12px; margin-top:5px;">Tips: 确认修改之后将会影响最终生成的代码逻辑</div>
9-
<div v-if="error" style="color: red; font-size:12px; margin-top:5px;">请检查语法错误:{{error}}</div>
6+
<div style="padding: 10px; display:flex;justify-content: flex-end;align-items: center;">
7+
<div>
8+
<el-button type="primary" @click="onSave">确认修改</el-button>
9+
<div v-if="error" style="color: red; font-size:12px; margin-top:5px;">请检查语法错误:{{error}}</div>
10+
</div>
11+
12+
<div style="margin-left: 5px;">
13+
<el-link href="https://vcc.sahadev.tech/doc/#/improve/logic?id=%e9%80%bb%e8%be%91%e6%a8%a1%e6%9d%bf"
14+
target="_blank" icon="el-icon-question">帮助与说明</el-link>
15+
<div style="color: #6c6c6c; font-size:12px; margin-top:5px;">Tips: 建议看一下使用说明</div>
16+
</div>
1017
</div>
1118
</el-dialog>
1219

@@ -19,26 +26,14 @@ import CodeEditor from './CodeEditor.vue'
1926
import prettier from "prettier/standalone";
2027
import babel from "prettier/parser-babel";
2128
22-
export default {
23-
props: ['codeDialogVisible'],
24-
components: {
25-
CodeEditor
26-
},
27-
28-
data() {
29-
return {
30-
error: '',
31-
code: dedent`
29+
const example = dedent`
3230
/**
3331
* 以下代码中的方法会被注入到最终的代码中,如果命名与源代码有相同的,则会替换源代码
3432
* 内部集成了axios,开发者可以直接通过axios发起网络请求,不过接口需要允许跨域。
3533
* 可以通过https://apis.sahadev.tech/exchange?url=的方式访问实际地址可以解决跨域问题。
3634
* axios官方文档:https://www.npmjs.com/package/axios
3735
*/
3836
{
39-
props: [],
40-
components: {},
41-
4237
data() {
4338
return {
4439
@@ -57,25 +52,20 @@ export default {
5752
axios.get('https://apis.sahadev.tech/exchange?url=https://www.baidu.com').then(res => console.info(res), err => console.error(err));
5853
}
5954
},
60-
61-
// 生命周期 start
62-
beforeCreate() {},
63-
created() {},
64-
65-
beforeMount() {},
66-
mounted() {},
67-
68-
beforeUpdate() {},
69-
updated() {},
70-
71-
beforeDestory() {},
72-
destoryed() {},
73-
// 生命周期 end
74-
75-
fillter: {},
7655
};
77-
7856
`
57+
58+
export default {
59+
props: ['codeDialogVisible'],
60+
components: {
61+
CodeEditor
62+
},
63+
64+
data() {
65+
return {
66+
error: '',
67+
code: example,
68+
example: `${example}`
7969
};
8070
},
8171
beforeCreate() { },

0 commit comments

Comments
 (0)