@@ -5,7 +5,6 @@ spline: base
55isComponent : true
66---
77
8- <span class =" coverages-badge " style =" margin-right : 10px " ><img src =" https://img.shields.io/badge/coverages%3A%20lines-100%25-blue " /></span ><span class =" coverages-badge " style =" margin-right : 10px " ><img src =" https://img.shields.io/badge/coverages%3A%20functions-100%25-blue " /></span ><span class =" coverages-badge " style =" margin-right : 10px " ><img src =" https://img.shields.io/badge/coverages%3A%20statements-100%25-blue " /></span ><span class =" coverages-badge " style =" margin-right : 10px " ><img src =" https://img.shields.io/badge/coverages%3A%20branches-100%25-blue " /></span >
98
109## 引入
1110
@@ -17,67 +16,43 @@ isComponent: true
1716}
1817```
1918
20- ## 代码演示
21-
22- <a href =" https://developers.weixin.qq.com/s/F1cSo7mm75SS " title =" 在开发者工具中预览效果 " target =" _blank " rel =" noopener noreferrer " > 在开发者工具中预览效果 </a >
23-
24- <blockquote style =" background-color : #d9e1ff ; font-size : 15px ; line-height : 26px ;margin : 16px 0 0 ;padding : 16px ; border-radius : 6px ; color : #0052d9 " >
25- <p >Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"</p >
26- </blockquote >
27-
2819### 01 组件类型
2920
30- 图片类型
21+ #### 图片类型
3122
3223{{ base }}
3324
34- 文件类型
25+ #### 文件类型
3526
3627{{ file }}
3728
3829### 02 组件状态
39- 图片类型加载状态
4030
41- {{ imageLoading }}
31+ #### 图片类型加载状态
32+
33+ {{ image-loading }}
4234
43- 文件类型加载状态
44- {{ fileLoading }}
35+ #### 文件类型加载状态
36+
37+ {{ file-loading }}
4538
4639## API
4740
4841### Attachments Props
4942
5043名称 | 类型 | 默认值 | 描述 | 必传
5144-- | -- | -- | -- | --
52- items | Array | [ ] | 附件列表。TS类型:FileItem[ ] | Y
45+ style | Object | - | 样式 | N
46+ custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
47+ addable | Boolean | true | 【讨论中】是否显示添加按钮 | N
48+ image-viewer | Boolean | true | 是否启用图片预览功能 | N
49+ items | Array | [ ] | 【实验】附件列表。TS 类型:` FileItem[] ` ` interface FileItem { fileType: 'image'\|'video'\|'audio'\|'pdf'\|'doc'\|'ppt'\|'txt'; name: string; url: string; size: number; status?: 'success'\|'fail'\|'pending'\|'error'; progress?: number; errorMessage?: string; fileIcon?: string; width?: number; height?: number; mode?: 'aspectFit' \| 'aspectFill' \| 'widthFix' \| 'heightFix' \| 'scaleToFill'} ` 。[ 详细类型定义] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/attachments/type.ts ) | N
5350removable | Boolean | true | 是否显示删除按钮 | N
54- imageViewer | Boolean | true | 是否启用图片预览功能 | N
55- addable | Boolean | true | 是否显示添加按钮 | N
56-
57-
58-
59-
60- ### FileItem 类型定义
61- ``` typescript
62- interface FileItem {
63- fileType: ' image' | ' video' | ' audio' | ' pdf' | ' doc' | ' ppt' | ' txt' // 文件类型
64- name: string // 文件名
65- url: string // 文件URL
66- size: number // 文件大小(KB)
67- status? : ' success' | ' fail' | ' pending' | ' error' // 上传状态
68- progress? : number // 上传进度(0-100)
69- errorMessage? : string // 错误信息
70- fileIcon? : string // 自定义文件图标URL
71- width? : number // 图片宽度(px)
72- height? : number // 图片高度(px)
73- mode? : ' aspectFit' | ' aspectFill' | ' widthFix' | ' heightFix' | ' scaleToFill' // 图片模式
74- }
7551
7652### Attachments Events
7753
7854名称 | 参数 | 描述
7955-- | -- | --
80- fileClick | ` (item: FileItem) ` | 点击文件时触发
56+ add | \- | 点击添加按钮时触发
57+ file-click | ` (item: FileItem) ` | 点击文件时触发
8158remove | ` (item: FileItem, index: number) ` | 点击删除按钮时触发
82- add | - | 点击添加按钮时触发
83-
0 commit comments