title |
nav |
group |
Upload - 上传 |
|
order |
title |
path |
1 |
Schemas |
/client/schemas |
|
Upload - 上传
Node Tree
Designable Bar
Examples
上传
import React from 'react';
import { Button } from 'antd'
import { UploadOutlined, InboxOutlined } from '@ant-design/icons'
import { SchemaRenderer } from '../';
import Upload from './';
const NormalUpload = (props) => {
return (
<Upload
{...props}
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
headers={{
authorization: 'authorization-text',
}}
>
<Button icon={<UploadOutlined />}>上传文件</Button>
</Upload>
)
}
const schema = {
type: 'object',
properties: {
input: {
type: 'string',
title: `编辑模式`,
'x-decorator': 'FormItem',
'x-component': 'NormalUpload',
'x-reactions': {
target: 'read',
fulfill: {
state: {
value: '{{$self.value}}',
},
},
},
},
read: {
type: 'string',
title: `阅读模式`,
'x-read-pretty': true,
'x-decorator': 'FormItem',
'x-component': 'NormalUpload',
},
}
};
export default () => {
return (
<SchemaRenderer components={{ NormalUpload }} schema={schema} />
);
};