update: 代码编辑器格式化

This commit is contained in:
JiangQiming 2023-02-20 16:54:17 +08:00
parent 45e2479831
commit b82c2ecda7
1 changed files with 14 additions and 0 deletions

View File

@ -59,6 +59,20 @@ onMounted(() => {
emit('update:modelValue', value);
});
});
/**
* 代码格式化
*/
const editorFormat = () => {
if (!instance) return;
instance.getAction('editor.action.formatDocument')?.run();
};
watchEffect(() => {
setTimeout(() => {
editorFormat();
}, 300);
});
</script>
<style lang="less" scoped>