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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • varchar与char的转换_character with byte sequence

    varchar与char的转换_character with byte sequence储存不区分大小写的字符数据TINYTEXT最大长度是255(2^8–1)个字符。TEXT最大长度是65535(2^16–1)个字符。MEDIUMTEXT最大长度是16777215(2^24–1)个字符。LONGTEXT最大长度是4294967295(2^32–1)个字符Varchar对每个英文(ASCII)字符都占用2个字节,对一个汉字也只占用两个…

    2022年8月13日
  • VS配置PCL“无法解析外部符号”

    VS配置PCL“无法解析外部符号”一开始报错:一般原因是没有包括需要的.lib报错说明可能出现在vtk和pcl_visualization的lib上。在依赖库中添加pcl_visualization.lib或者在.cmake文件中添加visualization重新编译,如下:===========================================================之后,报错只有两条:可知,现在只缺少vtk相关的lib。本人没有找到vtkLODActor和vtkShpe…

    2022年6月28日
  • 卸载宝塔linux面板_怎样叠宝塔

    卸载宝塔linux面板_怎样叠宝塔Linux宝塔的安装和卸载步骤一、安装宝塔二、卸载宝塔2.1下载宝塔的卸载文件2.2运行此文件根据提示卸载一、安装宝塔二、卸载宝塔2.1下载宝塔的卸载文件wgethttp://download.bt.cn/install/bt-uninstall.sh2.2运行此文件根据提示卸载shbt-uninstall.sh…

    2022年9月5日
  • [AVAudioIONodeImpl.mm:1158:SetOutputFormat: (format.sampleRate == hwFormat.s[通俗易懂]

    [AVAudioIONodeImpl.mm:1158:SetOutputFormat: (format.sampleRate == hwFormat.s[通俗易懂]AVAudioInputNode闪退问题[AVAudioIONodeImpl.mm:1158:SetOutputFormat:(format.sampleRate==hwFormat.sCrashedatinstallTapOnBus…//Configurethemicrophoneinput.AVAudioInputNode*inputNode=self.audioEngine.inputNode;//[inputNoderemoveTapOnBus:0];AV.

    2022年10月10日
  • [Android] Bitmap的内存计算

    本文聚焦的问题1、Bitmap中像素数据占用多大内存?如何计算?2、不同图片来源对内存大小有什么影响?Bitmap bitmap = Bitmap.createBitmap(100,100,Bitmap.Config.ARGB_8888);依然以如此声明一个bitmap为例,参数就决定了bitmap的大小。(以Android 8.0+平台为例,这行代码执行后占用的总内存大小=bitmap在…

    2022年3月11日

发表回复

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

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