mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
File下载补充valueField判断 (#1806)
This commit is contained in:
parent
89b8c7bf2c
commit
e1b8d3396d
@ -526,13 +526,18 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
|
||||
const {data, env, downloadUrl} = this.props;
|
||||
const urlField = this.props.urlField || 'url';
|
||||
const valueField = this.props.valueField || 'value';
|
||||
|
||||
const fileUrl =
|
||||
file[urlField as keyof typeof file] ||
|
||||
file[valueField as keyof typeof file];
|
||||
|
||||
let api =
|
||||
typeof downloadUrl === 'string' && !~downloadUrl.indexOf('$')
|
||||
? `${downloadUrl}${file[urlField as keyof typeof file]}`
|
||||
? `${downloadUrl}${fileUrl}`
|
||||
: downloadUrl
|
||||
? downloadUrl
|
||||
: `${file[urlField as keyof typeof file]}`;
|
||||
: `${fileUrl}`;
|
||||
|
||||
if (api) {
|
||||
const ctx = createObject(data, {
|
||||
|
Loading…
Reference in New Issue
Block a user