Appearance
AtMonacoEditor
沈孟平
最后更新于 2025-11-18 14:57:11
一个支持 naive 表单状态的编辑器,并且通过 cdn 加载 monaco-editor 实例,速度超快噢~
代码演示
API
AtMonacoEditor Props
| 名称 | 类型 | 默认值 | 说明 | 版本 |
|---|---|---|---|---|
| options | IStandaloneDiffEditorConstructionOptions | { readOnly: false, language: 'shell' } | 创建编辑器实例的选项 | |
| default-value | string | undefined | 编辑器的默认值 | |
| value | string | undefined | 编辑器输入的值 | |
| fullscreen-btn | AtIconButtonProps | undefined | 全屏按钮配置 | |
| on-blur | function | undefined | 编辑器失去焦点时触发 | |
| on-focus | function | undefined | 编辑器获得焦点时触发 | |
| on-change | function | undefined | 编辑器change 事件触发时触发 | |
| on-update:value | function | undefined | 编辑器值更新时触发 |
AtMonacoEditor Events
| 名称 | 参数 | 说明 | 版本 |
|---|---|---|---|
| blur | () | 编辑器失去焦点时触发 | |
| focus | () | 编辑器获得焦点时触发 | |
| change | (value: string) | 编辑器内容改变时触发 | |
| update:value | (value: string) | 编辑器值更新时触发(用于 v-model) | |
| updateValue | (value: string) | 编辑器值更新时触发(兼容性事件) |
AtMonacoEditor Expose
| 名称 | 类型 | 说明 | 版本 |
|---|---|---|---|
| editor-inst | editor.IStandaloneDiffEditor | null | 编辑器的实例 | v0.12.25 |