feat: 全局组件添加RichTextarea

This commit is contained in:
dap 2024-09-25 17:22:22 +08:00
parent 15851b063a
commit 8e39e7e70d
3 changed files with 10 additions and 7 deletions

View File

@ -34,6 +34,8 @@ import {
} from 'ant-design-vue'; } from 'ant-design-vue';
import { isArray } from 'lodash-es'; import { isArray } from 'lodash-es';
import { Tinymce as RichTextarea } from '#/components/tinymce';
// 这里需要自行根据业务组件库进行适配,需要用到的组件都需要在这里类型说明 // 这里需要自行根据业务组件库进行适配,需要用到的组件都需要在这里类型说明
export type FormComponentType = export type FormComponentType =
| 'AutoComplete' | 'AutoComplete'
@ -49,6 +51,7 @@ export type FormComponentType =
| 'RadioGroup' | 'RadioGroup'
| 'RangePicker' | 'RangePicker'
| 'Rate' | 'Rate'
| 'RichTextarea'
| 'Select' | 'Select'
| 'Space' | 'Space'
| 'Switch' | 'Switch'
@ -82,6 +85,7 @@ setupVbenForm<FormComponentType>({
RadioGroup, RadioGroup,
RangePicker, RangePicker,
Rate, Rate,
RichTextarea,
Select, Select,
Space, Space,
Switch, Switch,
@ -98,6 +102,7 @@ setupVbenForm<FormComponentType>({
modelPropNameMap: { modelPropNameMap: {
Checkbox: 'checked', Checkbox: 'checked',
Radio: 'checked', Radio: 'checked',
RichTextarea: 'modelValue',
Switch: 'checked', Switch: 'checked',
Upload: 'fileList', Upload: 'fileList',
}, },

View File

@ -81,7 +81,10 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required', rules: 'required',
}, },
{ {
component: 'Input', component: 'RichTextarea',
componentProps: {
width: '100%',
},
fieldName: 'noticeContent', fieldName: 'noticeContent',
formItemClass: 'col-span-2', formItemClass: 'col-span-2',
label: '公告内容', label: '公告内容',

View File

@ -7,7 +7,6 @@ import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter'; import { useVbenForm } from '#/adapter';
import { noticeAdd, noticeInfo, noticeUpdate } from '#/api/system/notice'; import { noticeAdd, noticeInfo, noticeUpdate } from '#/api/system/notice';
import { Tinymce } from '#/components/tinymce';
import { modalSchema } from './data'; import { modalSchema } from './data';
@ -70,10 +69,6 @@ async function handleCancel() {
<template> <template>
<BasicModal :fullscreen-button="true" :title="title" class="w-[800px]"> <BasicModal :fullscreen-button="true" :title="title" class="w-[800px]">
<BasicForm> <BasicForm />
<template #noticeContent="slotProps">
<Tinymce v-bind="slotProps" width="100%" />
</template>
</BasicForm>
</BasicModal> </BasicModal>
</template> </template>