$ cnpm install @uyun/ec-code-editor
作者:夏显林
<CodeEditor />
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
value | 编辑器的值 | object | {lang:'',content:''} |
languages | 可选择语言集合,头部使用 | array | [] |
showHeader | 是否显示编辑器头部 | boolean | true |
showFullScreen | 是否显示全屏按钮 | boolean | true |
readOnly | 是否只读。只读时,头部不在显示languages的全部数据,只显示当前类型的数据 | boolean | false |
disabled | 是否禁用 | boolean | false |
placeholder | 占位符,如果传入回调函数,则结构为lang => {} | string|Element|Function | '' |
highlightLines | 高亮行号集 | array | [] |
onChange | 修改回调函数 | 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