no message

This commit is contained in:
kuaifan 2022-04-25 05:03:52 +08:00
parent a723c2a44a
commit ab66b70485

View File

@ -210,8 +210,7 @@ export default {
} }
// set value and clear selection // set value and clear selection
this.editor.setValue(this.value) this.setValue(this.value)
this.editor.clearSelection()
// set ace editor options and theme // set ace editor options and theme
this.editor.setOptions(this.options) this.editor.setOptions(this.options)
@ -264,6 +263,17 @@ export default {
this.$nextTick(() => this.editor && this.editor.resize()) this.$nextTick(() => this.editor && this.editor.resize())
}, },
/**
* 设置内容
* @param value
*/
setValue(value) {
if (typeof value === "string" && this.editor) {
this.editor.setValue(value)
this.editor.clearSelection()
}
},
/** /**
* 获取文件类型 * 获取文件类型
* @returns {string} * @returns {string}
@ -359,8 +369,7 @@ export default {
if (newCode == this.code) { if (newCode == this.code) {
return; return;
} }
this.editor.setValue(newCode) this.setValue(newCode)
this.editor.clearSelection()
const {row, column} = this.cursorPosition const {row, column} = this.cursorPosition
// move cursor to current position // move cursor to current position
this.editor.selection.moveCursorTo(row, column) this.editor.selection.moveCursorTo(row, column)