规则引擎前端错误修改

This commit is contained in:
sxh
2022-04-22 16:33:33 +08:00
parent 7a83ba8984
commit 17438df5da
2 changed files with 16 additions and 10 deletions

View File

@@ -38,10 +38,7 @@ import "codemirror/addon/lint/lint.js";
export default { export default {
props: { props: {
value: { value: '',
type: String,
required: true,
},
height: { height: {
type: String, type: String,
required: true, required: true,
@@ -60,7 +57,11 @@ export default {
value(value) { value(value) {
const editorValue = this.editor.getValue(); const editorValue = this.editor.getValue();
if (value !== editorValue) { if (value !== editorValue) {
if (typeof this.value !== "undefined") {
this.editor.setValue(this.value); this.editor.setValue(this.value);
} else {
this.editor.setValue("");
}
} }
}, },
}, },
@@ -82,14 +83,19 @@ export default {
autoCloseBrackets: true, // 输入和退格时成对 autoCloseBrackets: true, // 输入和退格时成对
readOnly: false, // 只读 readOnly: false, // 只读
foldGutter: true, foldGutter: true,
autoRefresh: true autoRefresh: true,
}); });
//代码自动提示功能记住使用cursorActivity事件不要使用change事件这是一个坑那样页面直接会卡死 //代码自动提示功能记住使用cursorActivity事件不要使用change事件这是一个坑那样页面直接会卡死
this.editor.on("inputRead", () => { this.editor.on("inputRead", () => {
this.editor.showHint(); this.editor.showHint();
}); });
debugger;
this.editor.setSize("auto", this.height); this.editor.setSize("auto", this.height);
if (typeof this.value !== "undefined") {
this.editor.setValue(this.value); this.editor.setValue(this.value);
} else {
this.editor.setValue("");
}
}, },
methods: { methods: {
getValue() { getValue() {

View File

@@ -48,7 +48,7 @@
</el-card> </el-card>
<!-- 规则引擎详细 --> <!-- 规则引擎详细 -->
<el-dialog title="规则引擎详细" :visible.sync="openView" width="1200px" append-to-body> <el-dialog title="规则引擎详细" :visible.sync="openView" width="50%" append-to-body>
<el-form ref="form" :model="form" label-width="120px" size="mini"> <el-form ref="form" :model="form" label-width="120px" size="mini">
<el-card style="padding-bottom: 10px"> <el-card style="padding-bottom: 10px">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
@@ -155,7 +155,7 @@
</el-form-item> </el-form-item>
<el-form-item prop="test_columns.payload" v-if="form.test_columns"> <el-form-item prop="test_columns.payload" v-if="form.test_columns">
<span slot="label"> payload </span> <span slot="label"> payload </span>
<CodeMirrorEditor :value="form.test_columns.payload !==''?form.test_columns.payload: ''" myMode="application/json" height="150" /> <CodeMirrorEditor :value="form.test_columns.payload" myMode="application/json" height="150" />
</el-form-item> </el-form-item>
<el-form-item v-if="form.test_columns"> <el-form-item v-if="form.test_columns">
<el-button @click="testConnect" type="success" size="mini"> </el-button> <el-button @click="testConnect" type="success" size="mini"> </el-button>