refactor: 由于不能输入 需要使用watch监听

This commit is contained in:
dap 2024-11-27 10:29:19 +08:00
parent f4a1cc72d9
commit 56d77021c4

View File

@ -51,11 +51,20 @@ const content = defineModel('value', {
default: '',
});
/**
* 由于不能输入 需要使用watch监听
*/
watch(content, (value) => {
vditorInstance.value?.setValue(value);
});
onMounted(() => {
vditorInstance.value = new Vditor(vditorRef.value!, {
mode: 'wysiwyg',
value: content.value,
height: props.height,
//
// typewriterMode: true,
lang: locale.value.replace('-', '_') as any,
cache: {
enable: false,
@ -63,10 +72,6 @@ onMounted(() => {
theme: isDark.value ? 'dark' : 'classic',
// ()
toolbar: [],
//
input(value) {
content.value = value;
},
//
after() {
emit('mounted');