mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 11:07:52 +08:00
feat:图片缩略图占位图地址栏添加fx;占位图支持取fx变量
This commit is contained in:
parent
cdaeb01902
commit
5ecae394e5
@ -84,9 +84,8 @@ export class ImagePlugin extends BasePlugin {
|
|||||||
|
|
||||||
isUnderField
|
isUnderField
|
||||||
? null
|
? null
|
||||||
: getSchemaTpl('imageUrl', {
|
: getSchemaTpl('formulaControl', {
|
||||||
name: 'src',
|
name: 'src',
|
||||||
type: 'input-text',
|
|
||||||
label: '缩略图地址',
|
label: '缩略图地址',
|
||||||
description: '如果已绑定字段名,可以不用设置,支持用变量。'
|
description: '如果已绑定字段名,可以不用设置,支持用变量。'
|
||||||
}),
|
}),
|
||||||
@ -119,7 +118,7 @@ export class ImagePlugin extends BasePlugin {
|
|||||||
hiddenOn: 'this.enlargeAble',
|
hiddenOn: 'this.enlargeAble',
|
||||||
clearValueOnHidden: true
|
clearValueOnHidden: true
|
||||||
},
|
},
|
||||||
getSchemaTpl('imageUrl', {
|
getSchemaTpl('formulaControl', {
|
||||||
name: 'defaultImage',
|
name: 'defaultImage',
|
||||||
label: tipedLabel('占位图', '无数据时显示的图片')
|
label: tipedLabel('占位图', '无数据时显示的图片')
|
||||||
})
|
})
|
||||||
|
@ -506,6 +506,11 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
|
|||||||
let value = finnalSrc || getPropValue(this.props);
|
let value = finnalSrc || getPropValue(this.props);
|
||||||
const finnalHref = href ? filter(href, data, '| raw') : '';
|
const finnalHref = href ? filter(href, data, '| raw') : '';
|
||||||
|
|
||||||
|
const defaultValue = defaultImage
|
||||||
|
? filter(defaultImage, data, '| raw')
|
||||||
|
: '';
|
||||||
|
let defaultImageValue = defaultValue || getPropValue(this.props);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cx(
|
className={cx(
|
||||||
@ -528,14 +533,14 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
|
|||||||
thumbClassName={thumbClassName}
|
thumbClassName={thumbClassName}
|
||||||
height={height}
|
height={height}
|
||||||
width={width}
|
width={width}
|
||||||
src={value ? value : defaultImage}
|
src={value ? value : defaultImageValue}
|
||||||
href={finnalHref}
|
href={finnalHref}
|
||||||
title={filter(title, data)}
|
title={filter(title, data)}
|
||||||
caption={filter(imageCaption, data)}
|
caption={filter(imageCaption, data)}
|
||||||
thumbMode={thumbMode}
|
thumbMode={thumbMode}
|
||||||
thumbRatio={thumbRatio}
|
thumbRatio={thumbRatio}
|
||||||
originalSrc={filter(originalSrc, data, '| raw') ?? value}
|
originalSrc={filter(originalSrc, data, '| raw') ?? value}
|
||||||
enlargeAble={enlargeAble && value !== defaultImage}
|
enlargeAble={enlargeAble && value !== defaultImageValue}
|
||||||
onEnlarge={this.handleEnlarge}
|
onEnlarge={this.handleEnlarge}
|
||||||
imageMode={imageMode}
|
imageMode={imageMode}
|
||||||
imageControlClassName={imageControlClassName}
|
imageControlClassName={imageControlClassName}
|
||||||
|
Loading…
Reference in New Issue
Block a user