mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-04 21:17:36 +08:00
8829a233be
* feat(module: upload): Picture card demo * fix: clean code Co-authored-by: ElderJames <shunjiey@hotmail.com>
38 lines
952 B
C#
38 lines
952 B
C#
using System.Linq;
|
|
using System.Text.Json;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public class UploadFileItem
|
|
{
|
|
public string Id { get; set; }
|
|
|
|
public string FileName { get; set; }
|
|
|
|
public int Progress { get; set; }
|
|
|
|
public string ObjectURL { get; set; }
|
|
|
|
public string Url { get; set; }
|
|
|
|
public string Response { get; set; }
|
|
|
|
public UploadState State { get; set; }
|
|
|
|
public long Size { get; set; }
|
|
|
|
public string Ext { get; set; }
|
|
|
|
public string Type { get; set; }
|
|
|
|
public ResponseModel GetResponse<ResponseModel>(JsonSerializerOptions options = null) => JsonSerializer.Deserialize<ResponseModel>(this.Response, options);
|
|
|
|
public bool IsPicture()
|
|
{
|
|
string[] imageTypes = new[] { ".jpg", ".png", ".gif", ".ico" };
|
|
Ext = FileName.Substring(FileName.LastIndexOf('.'));
|
|
return imageTypes.Contains(Ext);
|
|
}
|
|
}
|
|
}
|