feat: form Editor component

pull/5/MERGE
xingyu 2023-04-27 13:21:50 +08:00
parent b4d2b61201
commit 110a352a1c
4 changed files with 5 additions and 8 deletions

View File

@ -32,6 +32,7 @@ import { BasicUpload } from '@/components/Upload'
import { StrengthMeter } from '@/components/StrengthMeter' import { StrengthMeter } from '@/components/StrengthMeter'
import { IconPicker } from '@/components/Icon' import { IconPicker } from '@/components/Icon'
import { CountdownInput } from '@/components/CountDown' import { CountdownInput } from '@/components/CountDown'
import { Tinymce } from '@/components/Tinymce'
const componentMap = new Map<ComponentType, Component>() const componentMap = new Map<ComponentType, Component>()
@ -71,6 +72,7 @@ componentMap.set('InputCountDown', CountdownInput)
componentMap.set('Upload', BasicUpload) componentMap.set('Upload', BasicUpload)
componentMap.set('Divider', Divider) componentMap.set('Divider', Divider)
componentMap.set('Editor', Tinymce)
export function add(compName: ComponentType, component: Component) { export function add(compName: ComponentType, component: Component) {
componentMap.set(compName, component) componentMap.set(compName, component)

View File

@ -115,3 +115,4 @@ export type ComponentType =
| 'Rate' | 'Rate'
| 'Divider' | 'Divider'
| 'ApiTransfer' | 'ApiTransfer'
| 'Editor'

View File

@ -1,15 +1,10 @@
<template> <template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? t('action.edit') : t('action.create')" @ok="handleSubmit"> <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? t('action.edit') : t('action.create')" @ok="handleSubmit">
<BasicForm @register="registerForm"> <BasicForm @register="registerForm" />
<template #editor="{ model, field }">
<Tinymce v-model="model[field]" width="100%" />
</template>
</BasicForm>
</BasicModal> </BasicModal>
</template> </template>
<script lang="ts" setup name="SystemNoticeModal"> <script lang="ts" setup name="SystemNoticeModal">
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { Tinymce } from '@/components/Tinymce'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { BasicForm, useForm } from '@/components/Form' import { BasicForm, useForm } from '@/components/Form'

View File

@ -90,7 +90,6 @@ export const formSchema: FormSchema[] = [
{ {
label: '内容', label: '内容',
field: 'content', field: 'content',
component: 'Input', component: 'Editor'
slot: 'editor'
} }
] ]