From 80df81a6314493efeb925c3b04119d05df1554a0 Mon Sep 17 00:00:00 2001 From: RickCole Date: Tue, 13 Apr 2021 15:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8Cfile=E6=97=A0=E6=B3=95=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#1792)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/File.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/renderers/Form/File.tsx b/src/renderers/Form/File.tsx index 3b99e7440..671156fee 100644 --- a/src/renderers/Form/File.tsx +++ b/src/renderers/Form/File.tsx @@ -312,12 +312,14 @@ export default class FileControl extends React.Component { ? 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 { ? { state: file && file.state ? file.state : 'init', [valueField]: value, + [urlField]: value, [nameField]: (file && file.name) || (/^data:/.test(value)