thaw/demo_markdown/docs/upload/mod.md

58 lines
1.7 KiB
Markdown
Raw Normal View History

# Upload
```rust demo
2024-07-08 00:29:04 +08:00
use send_wrapper::SendWrapper;
2024-07-08 12:01:05 +08:00
// let message = use_message();
2024-07-08 00:29:04 +08:00
let custom_request = move |file_list: SendWrapper<FileList>| {
2024-07-08 12:01:05 +08:00
// message.create(
// format!("Number of uploaded files: {}", file_list.length()),
// MessageVariant::Success,
// Default::default(),
// );
};
view!{
<Upload>
<Button>
"upload"
</Button>
</Upload>
}
```
### Drag to upload
```rust demo
2024-07-08 00:29:04 +08:00
2024-07-08 14:40:17 +08:00
// let message = use_message();
2024-07-19 17:30:46 +08:00
let custom_request = move |file_list: FileList| {
2024-07-08 14:40:17 +08:00
// message.create(
// format!("Number of uploaded files: {}", file_list.length()),
// MessageVariant::Success,
// Default::default(),
// );
};
view! {
<Upload custom_request>
<UploadDragger>"Click or drag a file to this area to upload"</UploadDragger>
</Upload>
}
```
### Upload Props
| Name | Type | Default | Description |
| -------------- | -------------------------------- | -------------------- | ------------------------------------ |
| accept | `MaybeSignal<String>` | `Default::default()` | The accept type of upload. |
| multiple | `MaybeSignal<bool>` | `false` | Allow multiple files to be selected. |
| custom_request | `Option<Callback<FileList, ()>>` | `Default::default()` | Customize upload request. |
| children | `Children` | | Upload's content. |
### UploadDragger Props
| Name | Type | Default | Description |
| -------- | ---------- | ------- | ------------------------ |
| children | `Children` | | UploadDragger's content. |