fix: ts类型错误

pull/38/head
xingyu 2023-10-11 09:33:03 +08:00
parent b343e80f6e
commit bdb7fdc3a3
1 changed files with 5 additions and 11 deletions

View File

@ -209,7 +209,7 @@ function initSetup(e) {
bindHandlers(e, attrs, unref(editorRef)) bindHandlers(e, attrs, unref(editorRef))
} }
function setValue(editor: Recordable, val: string, prevVal?: string) { function setValue(editor: Recordable, val?: string, prevVal?: string) {
if (editor && typeof val === 'string' && val !== prevVal && val !== editor.getContent({ format: attrs.outputFormat })) if (editor && typeof val === 'string' && val !== prevVal && val !== editor.getContent({ format: attrs.outputFormat }))
editor.setContent(val) editor.setContent(val)
} }
@ -220,14 +220,14 @@ function bindModelHandlers(editor: any) {
watch( watch(
() => props.modelValue, () => props.modelValue,
(val: string, prevVal: string) => { (val, prevVal) => {
setValue(editor, val, prevVal) setValue(editor, val, prevVal)
}, },
) )
watch( watch(
() => props.value, () => props.value,
(val: string, prevVal: string) => { (val, prevVal) => {
setValue(editor, val, prevVal) setValue(editor, val, prevVal)
}, },
{ {
@ -273,14 +273,8 @@ function getUploadingImgName(name: string) {
<template> <template>
<div :class="prefixCls" :style="{ width: containerWidth }"> <div :class="prefixCls" :style="{ width: containerWidth }">
<ImgUpload <ImgUpload v-if="showImageUpload" v-show="editorRef" :fullscreen="fullscreen" :disabled="disabled"
v-if="showImageUpload" @uploading="handleImageUploading" @done="handleDone" />
v-show="editorRef"
:fullscreen="fullscreen"
:disabled="disabled"
@uploading="handleImageUploading"
@done="handleDone"
/>
<textarea v-if="!initOptions.inline" :id="tinymceId" ref="elRef" :style="{ visibility: 'hidden' }" /> <textarea v-if="!initOptions.inline" :id="tinymceId" ref="elRef" :style="{ visibility: 'hidden' }" />
<slot v-else /> <slot v-else />
</div> </div>