refactor: 由于不能输入 需要使用watch监听
This commit is contained in:
parent
f4a1cc72d9
commit
56d77021c4
@ -51,11 +51,20 @@ const content = defineModel('value', {
|
|||||||
default: '',
|
default: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 由于不能输入 需要使用watch监听
|
||||||
|
*/
|
||||||
|
watch(content, (value) => {
|
||||||
|
vditorInstance.value?.setValue(value);
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
vditorInstance.value = new Vditor(vditorRef.value!, {
|
vditorInstance.value = new Vditor(vditorRef.value!, {
|
||||||
mode: 'wysiwyg',
|
mode: 'wysiwyg',
|
||||||
value: content.value,
|
value: content.value,
|
||||||
height: props.height,
|
height: props.height,
|
||||||
|
// 开启打字机模式
|
||||||
|
// typewriterMode: true,
|
||||||
lang: locale.value.replace('-', '_') as any,
|
lang: locale.value.replace('-', '_') as any,
|
||||||
cache: {
|
cache: {
|
||||||
enable: false,
|
enable: false,
|
||||||
@ -63,10 +72,6 @@ onMounted(() => {
|
|||||||
theme: isDark.value ? 'dark' : 'classic',
|
theme: isDark.value ? 'dark' : 'classic',
|
||||||
// 预览(只读模式) 不显示工具栏
|
// 预览(只读模式) 不显示工具栏
|
||||||
toolbar: [],
|
toolbar: [],
|
||||||
// 手动响应式
|
|
||||||
input(value) {
|
|
||||||
content.value = value;
|
|
||||||
},
|
|
||||||
// 加载完成的事件
|
// 加载完成的事件
|
||||||
after() {
|
after() {
|
||||||
emit('mounted');
|
emit('mounted');
|
||||||
|
Loading…
Reference in New Issue
Block a user