fix: code prettify

This commit is contained in:
JimQing 2020-05-03 11:02:27 +08:00
parent 53bbbed3c4
commit 21e21eedf3

View File

@ -77,6 +77,7 @@ export default {
aboutDialogVisible: false, aboutDialogVisible: false,
dialogFormVisible: false, dialogFormVisible: false,
timeout: null, timeout: null,
changeTimer: null,
source: '' source: ''
} }
}, },
@ -106,11 +107,13 @@ export default {
initEditor() { initEditor() {
this.initEditorEntity(); this.initEditorEntity();
this.editor.on('change', (cm, e) => { this.editor.on('change', (cm, e) => {
this.editorRefresh() if (this.changeTimer) clearTimeout(this.changeTimer);
setTimeout(() => { this.changeTimer = setTimeout(() => {
PR.prettyPrint() setTimeout(()=> PR.prettyPrint(), 0);
this.editorRefresh()
console.log('tick');
saveEditorContent(this.editor, '__editor_content')
}, 300); }, 300);
saveEditorContent(this.editor, '__editor_content')
}); });
// //