vue代码编辑器组件_vue activiti

vue代码编辑器组件_vue activitivue-monaco-editorMonacoEditorVueComponentBasedoffReactMonacoEditorSetupnpminstallvue-monaco-editor–saveSimpleVueUseimportMonacoEditorfrom’vue-monaco-edito…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

vue-monaco-editor

Monaco Editor Vue Component

Based off React Monaco Editor

experimental

Setup

 

npm install vue-monaco-editor –save

Simple Vue Use

 

import MonacoEditor from ‘vue-monaco-editor’

 

// use in component

export default {

  components: {

    MonacoEditor

  }

}

Component Props

Option Type Default Description
language String javascript  
height Number/String 100%  
width Number/String 100%  
code String // code \n Initial code to show
theme String vs-dark vs, hc-black, or vs-dark
highlighted Array[Object] [{ number: 0, class: ''}] Lines to highlight with numbers and .classes
changeThrottle Number(ms) 0 throttle codeChange emit
srcPath String "" see Webpack Use below
editorOptions Object Merged with defaults below See Monaco Editor Options

Editor Default Options

 

defaults: {

  selectOnLineNumbers: true,

  roundedSelection: false,

  readOnly: false,

  cursorStyle: ‘line’,

  automaticLayout: false,

  glyphMargin: true

}

Component Events

These events are available to parent component

Event Returns Description
mounted editor[editor instance] Emitted when editor has mounted
codeChange editor[editor instance] Emitted when code has changed

Example

Component Implementation

 

<MonacoEditor

    height=”600″

    language=”typescript”

    :code=”code”

    :editorOptions=”options”

    @mounted=”onMounted”

    @codeChange=”onCodeChange”

    >

</MonacoEditor>

Parent

 

module.exports = {

  components: {

    Monaco

  },

  data() {

    return {

      code: ‘// Type away! \n’,

      options: {

        selectOnLineNumbers: false

      }

    };

  },

  methods: {

    onMounted(editor) {

      this.editor = editor;

    },

    onCodeChange(editor) {

      console.log(this.editor.getValue());

    }

  }

};

Webpack Use

By default, monaco-editor is loaded from a cdn asyncronously using require. To use a local copy of monaco-editor with webpack, we need to expose the dependency in our build directory:

npm install copy-webpack-plugin --save-dev

Add this to your webpack.config.js:

 

const CopyWebpackPlugin = require(‘copy-webpack-plugin’);

module.exports = {

  plugins: [

    new CopyWebpackPlugin([

      {

        from: ‘node_modules/monaco-editor/min/vs’,

        to: ‘vs’,

      }

    ])

  ]

};

Then, specify the build directory path in the srcPath prop. See src/App.vue for an example.

Dev Use

git clone [this repo] .
npm install
npm run dev

Edit src/App.vue

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/170428.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • mybatiscodehelperpro2.9.3 激活【2021最新】

    (mybatiscodehelperpro2.9.3 激活)这是一篇idea技术相关文章,由全栈君为大家提供,主要知识点是关于2021JetBrains全家桶永久激活码的内容IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.htmlAFH5K5BM31-eyJsaWN…

    2022年3月30日
    221
  • 医疗大数据平台的主流解决方案

    医疗大数据平台的主流解决方案多源异构数据汇聚分发系统:通过数据汇集和分发服务引擎,按照统一的数据格式和接口规范采集来自于不同厂家、不同设备类型、不同数据格式、不同传输协议的体征数据,然后进行数据存储,最后通过消息开放服务中间件实时分发至电子健康档案系统。   统一资源池的电子健康档案系统:电子健康档案系统是实施医疗信息 化管理和提供个性化医护服务的核心,它以用户或患者为中心,建立人口统计信息、既往病史、健康因素、家…

    2022年5月5日
    38
  • C语言数组 一维数组篇

    C语言数组 一维数组篇前言:本文章主要用于个人复习,追求简洁,感谢大家的参考、交流和搬运,后续可能会继续修改和完善。因为是个人复习,会有部分压缩和省略。一、数组1.数组的定义:2.C语言规定:数组的每个元素都有下标,且下标是从0开始的。3.数组的使用4.数组使用时可能出现的错误越界访问:经典题型5.判断两个数组类型是否相同:…

    2022年7月22日
    8
  • cnetos6.4搭建tomcat7

    cnetos6.4搭建tomcat7

    2021年8月30日
    51
  • 2021韩顺平图解linux_狗剩学习笔记

    2021韩顺平图解linux_狗剩学习笔记韩顺平图解Linux全面升级https://www.bilibili.com/video/BV1Sv411r7vdP001_韩顺平图解Linux全面升级_课程内容20:37P002_韩顺平图解Linux全面升级_应用领域05:05P003_韩顺平图解Linux全面升级_概述16:37P004_韩顺平图解Linux全面升级_Linux与Unix18:09P005_韩顺平图解Linux全面升级_vmware15.5安装17:36P006_韩顺平图解

    2022年5月18日
    38
  • Ubuntu卸载软件:3种卸载方式

    Ubuntu卸载软件:3种卸载方式1.使用Synaptic软件包管理器进行卸载打开软件包管理器。Ubuntu自带了一个GUI(GraphicalUserInterface,图形化用户界面)软件包管理器,它可以让你在一个可视化窗口中卸载程序。如果你不习惯使用命令行,这一工具将非常有用。点击系统,然后选择管理。在管理菜单中,选择Synaptic软件包管理器。某些较新版本的Ubuntu没有预装Synaptic。要安装它,打…

    2022年5月7日
    688

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号