当前位置:首页 » 编程语言 » sqleditor

sqleditor

发布时间: 2024-07-05 12:20:39

Ⅰ oracle鏁版嵁搴撴庝箞镓揿紑sql绐楀彛锛堣緭鍏ユ煡澶勮鍙ワ级

1銆佸畨瑁呭苟镓揿紑toad鍙瑙嗗寲宸ュ叿銆

Ⅱ 如何采用element-plus,基于codemirror6实现sql在线编辑器

js在线sql编辑器,下载后导入IDE工具中,在浏览器访问sql-editor-master/index.html ,效果如下(含括号高亮显示、显示折叠栏):
codeMirror官网https://codemirror.net/, 官网js/css资源文件,也可自行去官网下载,但是官网比较慢,需引入的核心页面代码:
<link rel="stylesheet" href="css/codemirror.css" />
<link rel="stylesheet" href="test/addon/fold/foldgutter.css">
<link rel="stylesheet" href="css/theme/dracula.css" />
<link rel="stylesheet" href="css/show-hint.css" />
<link rel="stylesheet" href="js/jquery-easyui/themes/default/easyui.css">
<link rel="stylesheet" href="js/layui/css/layui.css">

<link rel="stylesheet" href="css/index.css" />
<script type="text/javascript">var baseUrl ="";</script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="js/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/editor/codemirror.js"></script>
<!-- 折叠栏显示 -->
<script type="text/javascript" src="test/addon/fold/foldcode.js"></script>
<script type="text/javascript" src="test/addon/fold/foldgutter.js"></script>
<script type="text/javascript" src="test/addon/fold/comment-fold.js"></script>
<!-- 括号高亮匹配 -->
<script type="text/javascript" src="test/addon/fold/matchbrackets.js"></script>

<script type="text/javascript" src="js/editor/sublime.js"></script>
<script type="text/javascript" src="js/editor/sql.js"></script>
<script type="text/javascript" src="js/editor/sql-hint.js"></script>
<script type="text/javascript" src="js/editor/show-hint.js"></script>
<!-- sql格式 -->
<script type="text/javascript" src="js/editor/formatting.js"></script>
<script type="text/javascript" src="js/editor/sql-formatter.min.js"></script>

<script type="text/javascript" src="js/layui/layui.js"></script>
<script type="text/javascript" src="js/index.js"></script>

<textarea id="code"></textarea>

核心js代码:

//根据DOM元素的id构造出一个编辑器
var editor=CodeMirror.fromTextArea(document.getElementById("code"),{
mode:"text/c-mysql", //实现Java代码高亮
lineNumbers:true,
matchBrackets: true, //括号高亮匹配
theme:"default",
keyMap: "default",
extraKeys:{"Tab":"autocomplete"},
hint: CodeMirror.hint.sql,
lineWrapping: true, //是否换行
foldGutter: true, //是否折叠
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], //添加行号栏,折叠栏
hintOptions: {
tables: tablewords

}

});

输入关键词提示等信息的配置:allWords.json

动态设置表字段等信息:

let tableWords = {"al": []};
let tableName = "tn_user";
tableWords[tableName].push("userId");
editor.setOption("hintOptions", {"tables": tableWords});
tableWords json格式如下:

"tableWords": {
"cp_sku": [
"skuid",
"cpbh",
"tcbh"
],
"user_info": [
"user_id",
"user_token",
"user_name",
"user_type",
"password"
]
}

Ⅲ 鍦∣racle浣跨敤sql璇鍙ヤ腑濡备綍鎻掑叆镞ユ湡镙煎纺镄勬暟鎹

1銆佽緭鍏ユ湇锷″櫒鍦板潃銆佹暟鎹搴撶橱褰旷敤鎴峰悕銆佺橱褰曞瘑镰侊纴瀹屾垚鏁版嵁搴撶橱褰曟搷浣溿

热点内容
预设存储器 发布:2024-11-26 16:47:38 浏览:13
如何打开云服务器的窗口 发布:2024-11-26 16:42:37 浏览:843
怎么自学编程入门 发布:2024-11-26 16:40:58 浏览:759
梦幻西游网页版脚本辅助神器 发布:2024-11-26 16:39:18 浏览:66
登陆社保账号密码是什么 发布:2024-11-26 16:23:03 浏览:896
优盾加密软件 发布:2024-11-26 16:15:52 浏览:655
热血传奇手游免费辅助脚本 发布:2024-11-26 15:59:03 浏览:220
安卓王者荣耀怎么设置回复血量 发布:2024-11-26 15:58:58 浏览:533
汽车空调压缩机轴承 发布:2024-11-26 15:58:56 浏览:960
c语言中53 发布:2024-11-26 15:56:36 浏览:281