mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 14:29:22 -05:00
3df65a4e26
* demo: init demo-markdown * demo: add include_md macro * demo: improve include_md macro * demo: improve include_md macro * demo: improve include_md macro * demo: improve code block * demo: add syntect css * demo: improve include_md macro * demo: include_md handle table
54 lines
1.7 KiB
Markdown
54 lines
1.7 KiB
Markdown
# Upload
|
|
|
|
```rust demo
|
|
let message = use_message();
|
|
let custom_request = move |file_list: FileList| {
|
|
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
|
|
let message = use_message();
|
|
let custom_request = move |file_list: FileList| {
|
|
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. |
|