mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
修复编辑状态,file无法下载的问题 (#1792)
This commit is contained in:
parent
13137dd8ad
commit
80df81a631
@ -312,12 +312,14 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
? find(files, item => (item as FileValue).value === value)
|
||||
: undefined;
|
||||
const valueField = props.valueField || 'value';
|
||||
const urlField = props.urlField || 'url';
|
||||
const nameField = props.nameField || 'name';
|
||||
return value
|
||||
? value instanceof File
|
||||
? {
|
||||
state: 'ready',
|
||||
[valueField]: value,
|
||||
[urlField]: value,
|
||||
[nameField]: value.name,
|
||||
id: guid()
|
||||
}
|
||||
@ -326,6 +328,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
? {
|
||||
state: file && file.state ? file.state : 'init',
|
||||
[valueField]: value,
|
||||
[urlField]: value,
|
||||
[nameField]:
|
||||
(file && file.name) ||
|
||||
(/^data:/.test(value)
|
||||
|
Loading…
Reference in New Issue
Block a user