# FilesCard
# Features
A file card component for displaying file information and providing file operations, with the following features:
- Automatic file type icon recognition (supports 40+ file types)
- File preview and download functions
- Support for custom action buttons
- Configurable file information display
- Multiple status displays (uploading, done, error)
- Special handling for image files (supports preview and layout variants)
- Custom icon color and size
# Usage Examples
# Basic Usage
Displays card components for different file types.
Copy
# Status Settings
Displays file cards in different states.
Copy
# Delete Functionality
Displays a file card with a delete button.
Copy
# Image File Display
Displays different variants and states of image files.
Image files with
preview
and
no preview
Image file
square variant
. Other formats are not affected by the variant property.
Image file default rectangle variant
supports upload status, enabling/disabling preview, and enabling/disabling preview mask
Image file square variant
supports upload status, enabling/disabling preview, and enabling/disabling preview mask
Copy
# Customization
Customize the icon color with the iconColor
attribute.
Customize styles with styleConfig
and hoverStyle
attributes.
Custom Colors
Custom Style / Hover Style
Copy
# Attributes
Attribute | Description | Type | Default |
---|---|---|---|
uid | Unique identifier | String/Number | - |
name | File name | String | - |
fileSize | File size | String/Number | - |
fileType | File type | String | - |
description | File description | String | - |
url | File URL | String | - |
thumbUrl | Thumbnail URL | String | - |
imgFile | Image file object | Object | - |
iconSize | Icon size | String | '42px' |
iconColor | Icon color | String | - |
showDelIcon | Whether to show the delete icon | Boolean | false |
maxWidth | Maximum width | String | '236px' |
styleConfig | Custom styles | Object | - |
hoverStyle | Hover styles | Object | - |
imgVariant | Image variant ('rectangle' or 'square') | String | 'rectangle' |
imgPreview | Whether to enable image preview | Boolean | true |
imgPreviewMask | Whether to show the image preview mask | Boolean | true |
status | File status ('uploading','done','error') | String | - |
percent | Upload progress (0-100) | Number | - |
errorTip | Error tip message | String | - |
# Events
Event Name | Description | Callback Parameters |
---|---|---|
delete | Triggered on delete button click | File data object |
image-preview | Triggered on image preview | File data object |
# Slots
Slot Name | Description | Scope Parameters |
---|---|---|
icon | Custom icon | item |
content | Custom content | item |
name-prefix | Custom file name prefix | item, prefix, suffix |
name-suffix | Custom file name suffix | item, prefix, suffix |
description | Custom description | item, prefix, suffix |
del-icon | Custom delete icon | item |
image-preview-actions | Custom image preview actions | item, prefix, suffix |