|
@@ -1,8 +1,8 @@
|
|
|
<!-- 富文本编辑器 -->
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div class="mb-2">
|
|
|
<div v-if="props.item?.label" class="ml-2 mb-2 color959595">{{ props.item.label }}</div>
|
|
|
- <div class="z-10 box mb-5">
|
|
|
+ <div class="z-10 box">
|
|
|
<!-- 工具栏 -->
|
|
|
<Toolbar
|
|
|
:editor="editorRef"
|
|
@@ -22,6 +22,7 @@
|
|
|
@on-created="handleCreated"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <div v-show="ruleTxt" class="ml-4" style="font-size: 13px; color: #FF5252; padding-top: 6px;">{{ ruleTxt }}</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
@@ -86,7 +87,8 @@ watch(
|
|
|
watch(
|
|
|
() => valueHtml.value,
|
|
|
(val) => {
|
|
|
- emit('update:modelValue', val === '<p><br></p>' ? '' : val)
|
|
|
+ const newVal = val === '<p><br></p>' ? '' : val
|
|
|
+ emit('update:modelValue', newVal)
|
|
|
}
|
|
|
)
|
|
|
|
|
@@ -102,9 +104,12 @@ const onMaxLengthFun = (editor) => {
|
|
|
if (maxLength) Snackbar.info(`最多可输入${maxLength}个字符`)
|
|
|
}
|
|
|
|
|
|
+const ruleTxt = ref('')
|
|
|
+
|
|
|
const onBlurFun = (editor) => {
|
|
|
- const text = editor.getText()?.replace(/\s+/g, '')
|
|
|
+ const text = editor.getText()?.replace(/\s+/g, '') || ''
|
|
|
if (!text) valueHtml.value = ''
|
|
|
+ ruleTxt.value = text ? '' : props.item.rules
|
|
|
}
|
|
|
|
|
|
// 编辑器配置
|