File下载补充valueField判断 (#1806)

This commit is contained in:
RickCole 2021-04-15 19:50:55 +08:00 committed by GitHub
parent 89b8c7bf2c
commit e1b8d3396d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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, {