amis/docs/components/form/editor.md
2020-07-28 10:03:53 +08:00

1.8 KiB
Executable File

title description type group menuName icon order
Editor 编辑器 0 null Editor 19

基本用法

{
    "type": "form",
    "api": "https://houtai.baidu.com/api/mock2/form/saveForm",
    "controls": [
        {
            "type": "editor",
            "name": "editor",
            "label": "编辑器"
        }
    ]
}

支持的语言

可以设置language配置高亮的语言,支持的语言有:

batccoffeescriptcppcsharpcssdockerfilefsharpgohandlebarshtmlinijavajavascriptjsonlessluamarkdownmsdaxobjective-cphpplaintextpostiatspowershellpugpythonrrazorrubysbscsssolsqlswifttypescriptvbxmlyaml

{
    "type": "form",
    "api": "https://houtai.baidu.com/api/mock2/form/saveForm",
    "controls": [
        {
            "type": "editor",
            "name": "editor",
            "label": "JSON编辑器",
            "language": "json"
        }
    ]
}

当然你也可以使用xxx-editor这种形式,例如"type": "json-editor"

{
    "type": "form",
    "api": "https://houtai.baidu.com/api/mock2/form/saveForm",
    "controls": [
        {
            "type": "json-editor",
            "name": "editor",
            "label": "JSON编辑器"
        }
    ]
}

属性表

除了支持 普通表单项属性表 中的配置以外,还支持下面一些配置

属性名 类型 默认值 说明
language string javascript 编辑器高亮的语言