@aliretail/react-materials-components
Version:
42 lines (38 loc) • 1.03 kB
Markdown
title: OssUploader
order: 121
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { FormComponents } from '@aliretail/react-materials-components';
const { Upload, SchemaForm, SchemaMarkupField: Field, createFormActions } = FormComponents;
const App = () => {
const formValue = {
imagePreview:
'https://img.alicdn.com/imgextra/i3/O1CN01AKswH11IZRteGQ6Jq_!!6000000000907-2-tps-754-1778.png',
img: 'https://img.alicdn.com/imgextra/i3/O1CN01AKswH11IZRteGQ6Jq_!!6000000000907-2-tps-754-1778.png',
};
return (
<SchemaForm onChange={console.log} value={formValue}>
<Field
x-component="OssUploader"
title="img"
name="img"
x-component-props={{
uploadType: 'image',
}}
/>
<Field
x-component="OssUploader"
title="imagePreview"
name="imagePreview"
x-component-props={{
isPreview: true,
}}
/>
</SchemaForm>
);
};
ReactDOM.render(<App />, mountNode);
```