UNPKG

yanzi-monaco-editor

Version:

这是一个基于微软的monaco和vue封装的一个代码编辑器,浏览器可运行。主要功能有:html、javascript、css代码编辑,高亮显示,语法错误提示等,可以帮您的项目很快的拥有一个web端的代码编辑器

113 lines (87 loc) 2.31 kB
/* eslint-disable */ const vue = `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- 网络资源 --> <link rel="stylesheet" href="https://code.xzlovecyy.com/files/element-ui/lib/theme-chalk/index.css"> <script src="https://code.xzlovecyy.com/files/js/vue.min.js"></script> <script src="https://code.xzlovecyy.com/files/element-ui/lib/index.js"></script> <!-- 本地资源 --> <!-- <link rel="stylesheet" href="./element-ui/lib/theme-chalk/index.css"> <script src="./element-ui/vue.min.js"></script> <script src="./element-ui/lib/index.js"></script> --> <title>Demo</title> <style> * { margin: 0; padding: 0; text-decoration: none; list-style: none; } body { height: 100vh; display: flex; justify-content: center; align-items: center; } </style> </head> <body> <div id="app"> <el-button size="" class="testButton" @click="open" icon="el-icon-loading" type="primary">点我 </el-button> </div> <script> ~ function () { new Vue({ el: '#app', data: { }, // 方法 methods: { open() { this.$alert('看到我就表示Vue和ElementUI加载成功了', '成功提示', { confirmButtonText: '好的,我知道了', callback: action => { this.$message({ type: 'info', message: action }); } }); } }, // Dom挂载完成 mounted() { } }) }(); <\/script> </body> </html>`; const html = `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> h1{ color:red; } </style> </head> <body> <h1>hello world</h1> <script> <\/script> </body> </html>`; /* eslint-disable */ export default { vue, html, };