ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] > [github](https://github.com/microsoft/monaco-editor) ## 安装 `npm install monaco-editor` ## 简单使用 ``` <!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > </head> <body> <div id="container" style="width:800px;height:600px;border:1px solid grey"></div> <script src="node_modules/monaco-editor/min/vs/loader.js" ></script> <script src="node_modules/requirejs/require.js"></script> <script> require.config({ paths: { 'vs': 'node_modules/monaco-editor/min/vs' }}); // vs/editor/editor.main.xxx.js  有多个文件需要导入 require(['vs/editor/editor.main'], function() { var editor = monaco.editor.create(document.getElementById('container'), { value: [ 'function x() {', '\tconsole.log("Hello world!");', '}' ].join('\n'), language: 'javascript' //设置语言     theme:"vs-dark",//'vs' (default), 'vs-dark', 'hc-black' }); }); </script> </body> </html> ```