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
|
||||
? null
|
||||
: getSchemaTpl('imageUrl', {
|
||||
: getSchemaTpl('formulaControl', {
|
||||
name: 'src',
|
||||
type: 'input-text',
|
||||
label: '缩略图地址',
|
||||
description: '如果已绑定字段名,可以不用设置,支持用变量。'
|
||||
}),
|
||||
@ -119,7 +118,7 @@ export class ImagePlugin extends BasePlugin {
|
||||
hiddenOn: 'this.enlargeAble',
|
||||
clearValueOnHidden: true
|
||||
},
|
||||
getSchemaTpl('imageUrl', {
|
||||
getSchemaTpl('formulaControl', {
|
||||
name: 'defaultImage',
|
||||
label: tipedLabel('占位图', '无数据时显示的图片')
|
||||
})
|
||||
|
@ -506,6 +506,11 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
|
||||
let value = finnalSrc || getPropValue(this.props);
|
||||
const finnalHref = href ? filter(href, data, '| raw') : '';
|
||||
|
||||
const defaultValue = defaultImage
|
||||
? filter(defaultImage, data, '| raw')
|
||||
: '';
|
||||
let defaultImageValue = defaultValue || getPropValue(this.props);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cx(
|
||||
@ -528,14 +533,14 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
|
||||
thumbClassName={thumbClassName}
|
||||
height={height}
|
||||
width={width}
|
||||
src={value ? value : defaultImage}
|
||||
src={value ? value : defaultImageValue}
|
||||
href={finnalHref}
|
||||
title={filter(title, data)}
|
||||
caption={filter(imageCaption, data)}
|
||||
thumbMode={thumbMode}
|
||||
thumbRatio={thumbRatio}
|
||||
originalSrc={filter(originalSrc, data, '| raw') ?? value}
|
||||
enlargeAble={enlargeAble && value !== defaultImage}
|
||||
enlargeAble={enlargeAble && value !== defaultImageValue}
|
||||
onEnlarge={this.handleEnlarge}
|
||||
imageMode={imageMode}
|
||||
imageControlClassName={imageControlClassName}
|
||||
|
Loading…
Reference in New Issue
Block a user