Open flyinhigh opened 6 years ago
Use setValue() on the editor object returned by the onMounted method: https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.icodeeditor.html#setvalue
The example shows how to get the editor object:
module.exports = {
components: {
Monaco
},
data() {
return {
code: '// Type away! \n',
options: {
selectOnLineNumbers: false
}
};
},
methods: {
onMounted(editor) {
this.editor = editor;
},
onCodeChange(editor) {
console.log(editor.getValue());
}
}
};
the :code is the initial code to show . it works only when it renders at the first time. if I want to change the code , how can I do ?