Closed clddup closed 5 months ago
富文本html.txt
当html内容为上面文件里的内容时, 会报错
排查发现在组件 watch 配置 immediate: true时 刚进来就给 valueHtml 赋值上面文本内容会报错
immediate: true
watch( () => props.modelValue, (val: string) => { if (val === unref(valueHtml)) return valueHtml.value = val }, { immediate: true } )
解决办法: 应该将 valueHtml 初始化赋值放到 handleCreated 函数中, 并将 immediate去掉
watch( () => props.modelValue, (val: string) => { if (val === unref(valueHtml)) return valueHtml.value = val } ) ```js const handleCreated = (editor: IDomEditor) => { editorRef.value = editor valueHtml.value = props.modelValue }
富文本html.txt
当html内容为上面文件里的内容时, 会报错
排查发现在组件 watch 配置
immediate: true
时 刚进来就给 valueHtml 赋值上面文本内容会报错解决办法: 应该将 valueHtml 初始化赋值放到 handleCreated 函数中, 并将 immediate去掉