Skip to content

Commit 1041120

Browse files
committed
feat: refactor: 移除 imageProps 属性,新增 FileItem 尺寸及模式属性
1 parent 6a9ec45 commit 1041120

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

packages/pro-components/chat/attachments/README.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ items | Array | [] | 文件列表数据,每个元素需包含fileType/name/url
5353
removable | Boolean | true | 是否显示删除按钮 | N
5454
imageViewer | Boolean | true | 是否启用图片预览功能 | N
5555
addable | Boolean | true | 是否显示添加按钮 | N
56-
imageProps | Object | { mode: 'scaleToFill', width: 52, height: 52 } | 图片组件的属性配置,包含mode(图片裁剪模式)、width(宽度)、height(高度) | N
56+
5757

5858

5959

@@ -68,8 +68,10 @@ interface FileItem {
6868
progress?: number // 上传进度(0-100)
6969
errorMessage?: string // 错误信息
7070
fileIcon?: string // 自定义文件图标URL
71+
width?: number // 图片宽度(px)
72+
height?: number // 图片高度(px)
73+
mode?: 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'scaleToFill' // 图片模式
7174
}
72-
```
7375

7476
### Attachments Events
7577

@@ -79,20 +81,3 @@ fileClick | `(item: FileItem)` | 点击文件时触发
7981
remove | `(item: FileItem, index: number)` | 点击删除按钮时触发
8082
add | - | 点击添加按钮时触发
8183

82-
### Attachments Slots
83-
84-
名称 | 作用域参数 | 描述
85-
-- | -- | --
86-
default | - | 自定义文件列表内容
87-
88-
### Attachments Methods
89-
90-
方法名 | 参数 | 返回值 | 描述
91-
-- | -- | -- | --
92-
handleFileClick | `item: FileItem` | - | 处理文件点击事件
93-
handleRemove | `item: FileItem, index: number` | - | 处理文件删除
94-
handleAdd | - | - | 处理添加按钮点击
95-
renderDesc | `item: FileItem` | string | 生成文件描述文本
96-
renderIcon | `item: FileItem` | string | 获取文件图标URL
97-
renderFileType | `item: FileItem` | string | 识别文件类型
98-
renderExtension | `item: FileItem` | string | 获取文件扩展名

packages/pro-components/chat/attachments/attachments.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ export default class Attachments extends SuperComponent {
2323
type: Boolean,
2424
value: true,
2525
},
26-
imageProps: {
27-
type: Object,
28-
value: {
29-
mode: 'scaleToFill',
30-
},
31-
},
3226
inChat: {
3327
type: Boolean,
3428
value: false,

packages/pro-components/chat/attachments/type.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,19 @@ export interface FileItem {
3737
* 自定义文件图标URL
3838
*/
3939
fileIcon?: string;
40+
/**
41+
* 图片宽度
42+
*/
43+
width?: number;
44+
/**
45+
* 图片高度
46+
*/
47+
height?: number;
48+
/**
49+
* 图片缩放模式
50+
*/
51+
mode?: 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'scaleToFill';
4052
}
41-
4253
export interface TdChatAttachmentsProps {
4354
/**
4455
* 文件列表数据,每个元素需包含fileType/name/url/size等属性

0 commit comments

Comments
 (0)