Momonaco-editor是微软提供的代码编辑器,vscode即是使用它作为编辑器。它的开发语言是ts,可以嵌入到浏览器中。
npm install monaco-editor复制代码
本人写Vue + Webpack 较多,以此为例:
之一种写法: 使用 monaco-editor-webpack-plugin
// .vue 对应的 script剧本中 import * as monaco from 'monaco-editor'; monaco.editor.create(document.getElementById('container'), { value: [ 'function x() {', '\tconsole.log("Hello world!");', '}' ].join('\n'), language: 'javascript' });
// 在 webpack.base.conf.js 中 // 需要安装 monaco-editor-webpack-plugin const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const path = require('path'); module.exports = { ... plugins: [ new MonacoWebpackPlugin() ] };
第二种写法:
// .vue 对应的 script剧本中 import * as monaco from 'monaco-editor'; // Since packaging is done by you, you need // to instruct the editor how you named the // bundles that contain the web workers. self.MonacoEnvironment = { getWorkerUrl: function (moduleId, label) { if (label === 'json') { return './json.worker.bundle.js'; } if (label === 'css') { return './css.worker.bundle.js'; } if (label === 'html') { return './html.worker.bundle.js'; } if (label === 'typescript' || label === 'javascript') { return './ts.worker.bundle.js'; } return './editor.worker.bundle.js'; } } monaco.editor.create(document.getElementById('container'), { value: [ 'function x() {', '\tconsole.log("Hello world!");', '}' ].join('\n'), language: 'javascript' });
// 在 webpack.base.conf.js 中 // 不需要安装任何剧本const path = require('path'); module.exports = { entry: { "app": './index.js', // Package each language's worker and give these filenames in `getWorkerUrl` "editor.worker": 'monaco-editor/e *** /vs/editor/editor.worker.js', "json.worker": 'monaco-editor/e *** /vs/language/json/json.worker', "css.worker": 'monaco-editor/e *** /vs/language/css/css.worker', "html.worker": 'monaco-editor/e *** /vs/language/html/html.worker', "ts.worker": 'monaco-editor/e *** /vs/language/typescript/ts.worker', }, ... };
网址icp办理备案是啥(网址icp办理备案怎么填)CP办理备案指的是网站域名使用者公司或本人在所属省的通讯管理局开展网址主体信息办理备案备案。 只需网络服务器在中国内地的网址,无论是本人還是企...
只要你有办法。什么软件都可以的。不仅仅是陌陌,qq,微信上面,你都可以, 陌陌嘛 在应用商店搜谈谈陌陌就会出来很多这样的软件 同城热约,单身交友,91约,附近交友软件,还有以前的陌陌啊,其实这类还有不...
B 侵略途径和歹意组件剖析#Python poc.py userid api_key api_secret图18 HackRF脚本遍历后得到完好的跳频序列0x020103 跳频逻辑总结[18:46:5...
网站落地页作为最终用户想要确定购买服务和产品的页面,如何让用户打开网站落地页,就萌发出想要完成下一步的支付行动。因此,我们在设计网站落地页的时候,就需要给用户提供这样的信息,以便让用户留下好印象。那么...
本文目录一览: 1、如何手机远程控制另一部手机 2、怎样用自己手机控制别人手机,就是远程控制 3、如何用自己的手机远程控制别人的手机? 4、怎样远程控制别人的手机 5、手机怎么远程控制...
十五分钟我们一定能送到您指定地点 赚个太阳乡巴佬 干货大多以名言警句式的形式出现,中国重庆将众多需要系统学习的理论和知识抽丝剥茧,“去其糟粕取其精华”,只留下结论。 在过去一年,美食我们看到,知乎的...