Appearance
monacoEditor
说明
在线代码编辑器
使用
vue
<script setup lang="ts">
import { MonacoEditor } from "liyao-vue-common"
</script>
<template>
<MonacoEditor />
</template>
1
2
3
4
5
6
7
2
3
4
5
6
7
可选参数
typescript
export const editorProps = {
width: {
type: [String, Number] as PropType<string | number>,
default: '100%'
},
height: {
type: [String, Number] as PropType<string | number>,
default: '500px'
},
theme: {
type: String as PropType<Theme>,
validator(value: string): boolean {
return ['vs', 'hc-black', 'vs-dark'].includes(value)
},
default: 'vs-dark'
},
options: {
type: Object as PropType<Partial<Options>>,
default() {
return {
automaticLayout: true,
foldingStrategy: 'indentation',
renderLineHighlight: 'all',
selectOnLineNumbers: true,
minimap: {
enabled: false
},
readOnly: false,
contextmenu: true,
fontSize: 16,
scrollBeyondLastLine: false,
overviewRulerBorder: false
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
更多配置请查看MonacoEditor官方文档