修改返回结果显示组件为Vue3AceEditor,增加xml返回值的支持

dev
RogerWork 3 months ago
parent 56f661fe4d
commit 34c5d2e180
  1. 2
      package.json
  2. 59
      src/VueAceEditor/aceConfig.js
  3. 2
      src/apis/ec_api.js
  4. 12
      src/main.js

@ -12,6 +12,7 @@
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@originjs/vite-plugin-commonjs": "^1.0.3", "@originjs/vite-plugin-commonjs": "^1.0.3",
"@types/node": "^20.10.4", "@types/node": "^20.10.4",
"ace-builds": "^1.35.4",
"axios": "^1.6.2", "axios": "^1.6.2",
"element-plus": "^2.4.3", "element-plus": "^2.4.3",
"json-editor-vue3": "^1.0.9", "json-editor-vue3": "^1.0.9",
@ -20,6 +21,7 @@
"vite-plugin-commonjs": "^0.10.1", "vite-plugin-commonjs": "^0.10.1",
"vue": "^3.3.8", "vue": "^3.3.8",
"vue-router": "^4.0.13", "vue-router": "^4.0.13",
"vue3-ace-editor": "^2.2.4",
"vuex": "^4.0.2", "vuex": "^4.0.2",
"ws": "^8.16.0" "ws": "^8.16.0"
}, },

@ -0,0 +1,59 @@
// ace配置,使用动态加载来避免第一次加载开销
import ace from 'ace-builds'
// 导入不同的主题模块,并设置对应 URL
import themeGithubUrl from 'ace-builds/src-noconflict/theme-github?url'
ace.config.setModuleUrl('ace/theme/github', themeGithubUrl)
import themeChromeUrl from 'ace-builds/src-noconflict/theme-chrome?url'
ace.config.setModuleUrl('ace/theme/chrome', themeChromeUrl)
import themeMonokaiUrl from 'ace-builds/src-noconflict/theme-monokai?url'
ace.config.setModuleUrl('ace/theme/monokai', themeMonokaiUrl)
// 导入不同语言的语法模式模块,并设置对应 URL (所有支持的主题和模式:node_modules/ace-builds/src-noconflict)
import modeJsonUrl from 'ace-builds/src-noconflict/mode-json?url'
ace.config.setModuleUrl('ace/mode/json', modeJsonUrl)
import modeJavascriptUrl from 'ace-builds/src-noconflict/mode-javascript?url'
ace.config.setModuleUrl('ace/mode/javascript', modeJavascriptUrl)
import modeHtmlUrl from 'ace-builds/src-noconflict/mode-html?url'
ace.config.setModuleUrl('ace/mode/html', modeHtmlUrl)
import modePythonUrl from 'ace-builds/src-noconflict/mode-python?url'
ace.config.setModuleUrl('ace/mode/yaml', modePythonUrl)
// 用于完成语法检查、代码提示、自动补全等代码编辑功能,必须注册模块 ace/mode/lang _ worker,并设置选项 useWorker: true
import workerBaseUrl from 'ace-builds/src-noconflict/worker-base?url'
ace.config.setModuleUrl('ace/mode/base', workerBaseUrl)
import workerJsonUrl from 'ace-builds/src-noconflict/worker-json?url' // for vite
ace.config.setModuleUrl('ace/mode/json_worker', workerJsonUrl)
import workerJavascriptUrl from 'ace-builds/src-noconflict/worker-javascript?url'
ace.config.setModuleUrl('ace/mode/javascript_worker', workerJavascriptUrl)
import workerHtmlUrl from 'ace-builds/src-noconflict/worker-html?url'
ace.config.setModuleUrl('ace/mode/html_worker', workerHtmlUrl)
// 导入不同语言的代码片段,提供代码自动补全和代码块功能
import snippetsJsonUrl from 'ace-builds/src-noconflict/snippets/json?url'
ace.config.setModuleUrl('ace/snippets/json', snippetsJsonUrl)
import snippetsJsUrl from 'ace-builds/src-noconflict/snippets/javascript?url'
ace.config.setModuleUrl('ace/snippets/javascript', snippetsJsUrl)
import snippetsHtmlUrl from 'ace-builds/src-noconflict/snippets/html?url'
ace.config.setModuleUrl('ace/snippets/html', snippetsHtmlUrl)
import snippetsPyhontUrl from 'ace-builds/src-noconflict/snippets/python?url'
ace.config.setModuleUrl('ace/snippets/javascript', snippetsPyhontUrl)
// 启用自动补全等高级编辑支持,
import extSearchboxUrl from 'ace-builds/src-noconflict/ext-searchbox?url'
ace.config.setModuleUrl('ace/ext/searchbox', extSearchboxUrl)
// 启用自动补全等高级编辑支持
// import 'ace-builds/src-noconflict/ext-language_tools'
// ace.require('ace/ext/language_tools')

@ -84,7 +84,7 @@ export const ec_api_send_request = (req_data) => {
env: req_data.env, env: req_data.env,
member_type: req_data.type, member_type: req_data.type,
api: req_data.api, api: req_data.api,
params: req_data.params params: req_data.params,
} }
}) })
} }

@ -12,6 +12,18 @@ import "element-plus/theme-chalk/el-message.css";
import "element-plus/theme-chalk/el-notification.css"; import "element-plus/theme-chalk/el-notification.css";
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
// 引入Ace Editor
import 'ace-builds/src-noconflict/ace';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/mode-html';
import 'ace-builds/src-noconflict/theme-chrome';
import 'ace-builds/src-noconflict/worker-base';
import 'ace-builds/src-noconflict/worker-json';
import 'ace-builds/src-noconflict/worker-html';
import 'ace-builds/src-noconflict/snippets/json';
import 'ace-builds/src-noconflict/snippets/html';
import 'ace-builds/src-noconflict/ext-searchbox';
const app = createApp(App) const app = createApp(App)
for (const name in ELIcons) { for (const name in ELIcons) {

Loading…
Cancel
Save