2、Codecademy:Codecademy是一个在线编程学习网站,提供了很多关于HTML、CSS、JavaScript、jQuery、PHP、Python等的入门教程和实践练习,非常适合初学者学习。
3、Treehouse:Treehouse是一个在线编程学习网站,提供了很多关于HTML、CSS、JavaScript、jQuery、PHP、Python等的入门教程和实践练习,非常适合初学者学习。
4、Code Avengers:Code Avengers是一个在线编程学习网站,提供了很多关于HTML、CSS、JavaScript、jQuery、PHP、Python等的入门教程和实践练习,非常适合初学者学习。
5、CodePen:CodePen是一个在线编程编辑器,支持HTML、CSS、JavaScript、jQuery等语言,非常适合初学者练习和实践。
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 = {"dual": []}
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"
]
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)