Pon*_* VN 17
这样的事情会对你有所帮助.
首先设置代码镜像
this.editor = CodeMirror.fromTextArea(document.getElementById("testAreaCodeMirror"), {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"eclipse",
mode:language
});
Run Code Online (Sandbox Code Playgroud)
然后改变模式
this.editor.setOption("mode", language);
Run Code Online (Sandbox Code Playgroud)
Mar*_*ijn 13
如果这是CodeMirror 2或3,请使用setOption("mode", <new mode>)(docs for setOption,"mode").
对于CodeMirror 1,请使用该setParser方法.
| 归档时间: |
|
| 查看次数: |
7080 次 |
| 最近记录: |