下载地址:
https://microsoft.github.io/monaco-editor/
下载完成后解压,只需要如下文件夹中内容
package/min/vs/
将所需文件夹拖入项目,在项目中引用
<script type="text/javascript" src="../static/monaco/loader.js"></script>
<script type="text/javascript" src="../static/monaco/basic-languages/sql/sql.js"></script>
<div id="container" class="editor-container">
require.config({ paths: { 'vs': '../static/monaco' }});
require.config({'vs/nls': {availableLanguages: {'*':'zh-cn'}}});
require(['vs/editor/editor.main'],function(){
var editor = monaco.editor.create(document.getElementById('container'), {
value: 'SELECT * FROM myindex',
language: 'sql',
theme:'vs-dark'
});
});
具体使用,请参考vue下使用Mocano Editor