refactor: 优化终端交互.
This commit is contained in:
@@ -43,6 +43,10 @@
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
autoFocus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
default: 'json',
|
||||
@@ -76,6 +80,10 @@
|
||||
};
|
||||
// 创建编辑器
|
||||
editor = monaco.editor.create(editorContainer.value, options);
|
||||
// 自动聚焦
|
||||
if (props.autoFocus) {
|
||||
editor.focus();
|
||||
}
|
||||
// 监听值的变化
|
||||
editor.onDidChangeModelContent(() => {
|
||||
const value = editor.getValue();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<div :style="{ width: '100%', 'height': height }">
|
||||
<editor v-model="value"
|
||||
language="shell"
|
||||
:auto-focus="true"
|
||||
:theme="dark ? 'vs-dark' : 'vs'" />
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
Reference in New Issue
Block a user