mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vue3.git
synced 2025-12-30 09:32:26 +00:00
fix:Editor 开启、禁用不生效的问题
This commit is contained in:
@@ -8,6 +8,7 @@ import { ElMessage } from 'element-plus'
|
||||
import { useLocaleStore } from '@/store/modules/locale'
|
||||
import { getRefreshToken, getTenantId } from '@/utils/auth'
|
||||
import { getUploadUrl } from '@/components/UploadFile/src/useUpload'
|
||||
import merge from 'lodash-es/merge'
|
||||
|
||||
defineOptions({ name: 'Editor' })
|
||||
|
||||
@@ -60,7 +61,11 @@ watch(
|
||||
)
|
||||
watch(
|
||||
() => props.readonly,
|
||||
(val) => {
|
||||
async (val) => {
|
||||
// 特殊:等待 editorRef 渲染完成
|
||||
if (!editorRef.value) {
|
||||
await nextTick()
|
||||
}
|
||||
if (val) {
|
||||
editorRef.value?.disable()
|
||||
} else {
|
||||
@@ -75,7 +80,7 @@ const handleCreated = (editor: IDomEditor) => {
|
||||
|
||||
// 编辑器配置
|
||||
const editorConfig = computed((): IEditorConfig => {
|
||||
return Object.assign(
|
||||
return merge(
|
||||
{
|
||||
placeholder: '请输入内容...',
|
||||
readOnly: props.readonly,
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" :disabled="isDetail">
|
||||
<!--富文本编辑器组件-->
|
||||
<el-form-item label="商品详情" prop="description">
|
||||
<Editor v-if="!isDetail" v-model:modelValue="formData.description" />
|
||||
<Editor v-else :modelValue="formData.description" readonly />
|
||||
<Editor :readonly="isDetail" v-model:modelValue="formData.description" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user