Commit ebe0554c authored by 刘殿昕's avatar 刘殿昕

json格式化

parent 522b2148
...@@ -17,12 +17,17 @@ import ace from "ace-builds"; ...@@ -17,12 +17,17 @@ import ace from "ace-builds";
import "ace-builds/webpack-resolver"; // 在 webpack 环境中使用必须要导入 import "ace-builds/webpack-resolver"; // 在 webpack 环境中使用必须要导入
import "ace-builds/src-noconflict/mode-json"; // 默认设置的语言模式 import "ace-builds/src-noconflict/mode-json"; // 默认设置的语言模式
export default { export default {
props: ["url","datas",'readOnly'], props: {
url: {
type: String,
default: "",
},
datas: { type: String, default: "" },
readOnly: { type: Boolean, default: false },
},
data() { data() {
return { return {
aceEditor: null, aceEditor: null,
themePath: "ace/theme/monokai", // 不导入 webpack-resolver,该模块路径会报错
modePath: this.acemodePath
}; };
}, },
...@@ -31,17 +36,18 @@ export default { ...@@ -31,17 +36,18 @@ export default {
maxLines: 24, maxLines: 24,
minLines: 10, minLines: 10,
fontSize: 14, fontSize: 14,
mode: this.acemodePath, wrap: true,
wrap: this.wrap, tabSize: 2,
tabSize: 4,
highlightActiveLine: false, highlightActiveLine: false,
readOnly:this.readOnly?this.readOnly:false readOnly: this.readOnly,
}); });
if (this.url) { if (this.url) {
this.getValue(); this.getValue();
} }
if (this.datas) { if (this.datas) {
this.aceEditor.setValue(this.datas); this.aceEditor.setValue(
JSON.stringify(JSON.parse(this.datas), null, "\t")
);
} }
}, },
watch: {}, watch: {},
...@@ -49,10 +55,10 @@ export default { ...@@ -49,10 +55,10 @@ export default {
getValue() { getValue() {
this.$http this.$http
.get(this.url) .get(this.url)
.then(response => { .then((response) => {
this.aceEditor.setValue(response.data); this.aceEditor.setValue(response.data);
}) })
.catch(function(response) { .catch(function (response) {
console.log(response); console.log(response);
}); });
}, },
...@@ -61,8 +67,8 @@ export default { ...@@ -61,8 +67,8 @@ export default {
}, },
getCodesVal() { getCodesVal() {
return this.aceEditor.getValue(); return this.aceEditor.getValue();
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
:stripe="true" :stripe="true"
slot="res_table" slot="res_table"
></table-um> ></table-um>
<v-apaas-code :datas="res_code_arr" slot="res_code"></v-apaas-code> <v-apaas-code :datas="res_code_arr" slot="res_code" :readOnly="true"></v-apaas-code>
</info-list> </info-list>
<p v-if="now_service == 1&&workflows_id"> <p v-if="now_service == 1&&workflows_id">
流程服务接口说明见文档中心流程服务接口文档 流程服务接口说明见文档中心流程服务接口文档
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment