diff --git a/src/components/Form/index.ts b/src/components/Form/index.ts index d85b3c517..d3be25e95 100644 --- a/src/components/Form/index.ts +++ b/src/components/Form/index.ts @@ -13,5 +13,6 @@ export { default as ApiTree } from './src/components/ApiTree.vue'; export { default as ApiRadioGroup } from './src/components/ApiRadioGroup.vue'; export { default as ApiCascader } from './src/components/ApiCascader.vue'; export { default as ApiTransfer } from './src/components/ApiTransfer.vue'; +export { default as ImageUpload } from './src/components/ImageUpload.vue'; export { BasicForm }; diff --git a/src/components/Form/src/componentMap.ts b/src/components/Form/src/componentMap.ts index b448ace99..f33a5890c 100644 --- a/src/components/Form/src/componentMap.ts +++ b/src/components/Form/src/componentMap.ts @@ -5,22 +5,21 @@ import type { ComponentType } from './types/index'; * Component list, register here to setting it in the form */ import { - Input, - Select, - Radio, - Checkbox, AutoComplete, Cascader, + Checkbox, DatePicker, + Divider, + Input, InputNumber, + Radio, + Rate, + Select, + Slider, Switch, TimePicker, TreeSelect, - Slider, - Rate, - Divider, } from 'ant-design-vue'; - import ApiRadioGroup from './components/ApiRadioGroup.vue'; import RadioButtonGroup from './components/RadioButtonGroup.vue'; import ApiSelect from './components/ApiSelect.vue'; @@ -28,6 +27,7 @@ import ApiTree from './components/ApiTree.vue'; import ApiTreeSelect from './components/ApiTreeSelect.vue'; import ApiCascader from './components/ApiCascader.vue'; import ApiTransfer from './components/ApiTransfer.vue'; +import ImageUpload from './components/ImageUpload.vue'; import { BasicUpload } from '/@/components/Upload'; import { StrengthMeter } from '/@/components/StrengthMeter'; import { IconPicker } from '/@/components/Icon'; @@ -42,7 +42,7 @@ componentMap.set('InputSearch', Input.Search); componentMap.set('InputTextArea', Input.TextArea); componentMap.set('InputNumber', InputNumber); componentMap.set('AutoComplete', AutoComplete); - +componentMap.set('ImageUpload', ImageUpload); componentMap.set('Select', Select); componentMap.set('ApiSelect', ApiSelect); componentMap.set('ApiTree', ApiTree); diff --git a/src/components/Form/src/components/ImageUpload.vue b/src/components/Form/src/components/ImageUpload.vue new file mode 100644 index 000000000..22fec05e9 --- /dev/null +++ b/src/components/Form/src/components/ImageUpload.vue @@ -0,0 +1,253 @@ + + + + + diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts index 66505f590..3e0136580 100644 --- a/src/components/Form/src/helper.ts +++ b/src/components/Form/src/helper.ts @@ -86,5 +86,6 @@ export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [ 'ApiCascader', 'AutoComplete', 'RadioButtonGroup', + 'ImageUpload', 'ApiSelect', ]; diff --git a/src/components/Form/src/types/index.ts b/src/components/Form/src/types/index.ts index 55f10dec4..79e4aaabf 100644 --- a/src/components/Form/src/types/index.ts +++ b/src/components/Form/src/types/index.ts @@ -110,6 +110,7 @@ export type ComponentType = | 'Switch' | 'StrengthMeter' | 'Upload' + | 'ImageUpload' | 'IconPicker' | 'Render' | 'Slider' diff --git a/src/views/demo/form/index.vue b/src/views/demo/form/index.vue index 89fd096bd..fc58cc227 100644 --- a/src/views/demo/form/index.vue +++ b/src/views/demo/form/index.vue @@ -697,6 +697,17 @@ allowHalf: true, }, }, + { + field: 'field23', + component: 'ImageUpload', + label: '字段23', + colProps: { + span: 8, + }, + componentProps: { + api: () => Promise.resolve('https://via.placeholder.com/600/92c952'), + }, + }, ]; export default defineComponent({