$ cnpm install @uyun/ec-code-editor
组件功能描述
$ npm i @uyun/ec-code-editor --save
import CodeEditor from '@uyun/ec-code-editor';
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
value | 编辑器的值 | object | {lang:'',content:''} |
languages | 可选择语言集合,头部使用 | array | [] |
showHeader | 是否显示编辑器头部 | boolean | true |
theme | 编辑器主题,浅色是 eclipse,深色是 monokai | string | eclipse |
showFullScreen | 是否显示全屏按钮 | boolean | true |
readOnly | 是否只读。只读时,头部不在显示 languages 的全部数据,只显示当前类型的数据 | boolean | false |
disabled | 是否禁用 | boolean | false |
placeholder | 占位符,如果传入回调函数,则结构为 lang => {}, 返回值也要是字符串 | string|Function | '' |
highlightLines | 高亮行号集 | array | [] |
onChange | 修改回调函数 | Function | value => {} |
handleShowHint | 自定义输入提示 | Function | value => {} |
其他参数参考 CodeMirror 官方文档:https://codemirror.net/doc/manual.html#config
{
lang:"",
content:""
}
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
lang | 语言类型 | string | '' |
content | 代码内容 | string | '' |
目前提供高亮的语言类型:shell、python、vbscript、groovy、yaml、powershell、perl、batch。
{
lang:"",
title:""
}
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
lang | 语言类型 | string | '' |
title | 语言标题,在编辑器头部做展示使用 | string | '' |
支持行号集,如[1,2,3],也支持自定义背景颜色
{
index:1,
background:"red"
}
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
index | 行索引 | index | -1 |
background | 背景颜色 | string | ‘' |
Copyright 2013 - present © cnpmjs.org