ready(){
var myTextarea=document.getElementById("myeditor")
var _self = this;
var editor=CodeMirror.fromTextArea(myTextarea, {
lineNumbers: true,//设置行号 boolean
value: 'SELECT * FROM table',//编辑框初始值 string
mode: 'text/x-mysql',//当前code模式 模式的选择可以在CodeMirror.modes中查看
height: 100,//高度
indentUnit: 4,//缩进块用多少个空格表示 默认是2
autofocus: true,
//此处是引用sql-hint.js的配置项
hintOptions:{
completeSingle: false, //当匹配只有一项的时候是否自动补全
tables: {
table1: ['name', 'score', 'birthDate'],
table2: ['name', 'population', 'size']
}
},//表元信息
extraKeys: {//快捷键 可提供三种模式 sublime、emacs、vim。 使用时需要引入js支持包
"F9": function (editor) {
format(editor);
},
"F8": functio