Files
MujicaUI/docs/components/222-attachment-chip.md
T

39 lines
909 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 222 AttachmentChip 附件标签
## 用途
附件名、类型、大小、上传进度、移除;失败重试。
## 最小示例
```go
view := func(c *ui.Context) {
mujica.Use(c, mujica.Settings{})
r := mujica.AttachmentChip(c, mujica.Attachment{Name: "guests.csv", Size: 4096, Uploading: true, Progress: 0.4})
if r.Removed() {
fmt.Println("cancel the upload")
}
}
ui.Render(view, 400, 300, 1)
```
## 参数
`Attachment.Name` 必填;`Type` 为 MIME 类型,空值按扩展名选择图标;`Size` 为非负字节数;`Uploading` 默认 false,`Progress` 为 0–1;`Err` 表示上传失败。
## 状态
默认、悬停、键盘焦点与祖先禁用;业务状态由调用方提供。
## 事件
Removed() 表示移除;Retried() 表示重试。
## 键盘操作
Tab 到移除与重试;Enter、Space 激活。
## 限制
上传由调用方执行,组件只展示进度与结果。