mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复背景图选择参数错误问题
This commit is contained in:
parent
195a93aff8
commit
e3ad9b9271
@ -671,12 +671,15 @@ function ImageInput(props: ThemeColorProps) {
|
|||||||
if (imgRes) {
|
if (imgRes) {
|
||||||
let img = imgRes[1];
|
let img = imgRes[1];
|
||||||
setImage(img);
|
setImage(img);
|
||||||
let res = value.replace(imgRes[0] + ' ', '');
|
let res = value;
|
||||||
|
!res.endsWith(' ') && (res += ' ');
|
||||||
|
res = value.replace(imgRes[0] + ' ', '');
|
||||||
let list = res.split(' ');
|
let list = res.split(' ');
|
||||||
// 解析position
|
// 解析position
|
||||||
let position = list[0] + ' ' + list[1];
|
let position = list[0] + ' ' + list[1];
|
||||||
const index = POSITION_MAP.findIndex(n => n === position);
|
const index = POSITION_MAP.findIndex(n => n === position);
|
||||||
setPosition(index);
|
setPosition(index);
|
||||||
|
!res.endsWith(' ') && (res += ' ');
|
||||||
res = res.replace(position + ' / ', '');
|
res = res.replace(position + ' / ', '');
|
||||||
list = res.split(' ');
|
list = res.split(' ');
|
||||||
// 解析mode
|
// 解析mode
|
||||||
@ -688,6 +691,7 @@ function ImageInput(props: ThemeColorProps) {
|
|||||||
mode = '100% 100% no-repeat';
|
mode = '100% 100% no-repeat';
|
||||||
}
|
}
|
||||||
setMode(mode);
|
setMode(mode);
|
||||||
|
!res.endsWith(' ') && (res += ' ');
|
||||||
// 解析color
|
// 解析color
|
||||||
const color = res.replace(mode + ' ', '');
|
const color = res.replace(mode + ' ', '');
|
||||||
setColor(color);
|
setColor(color);
|
||||||
@ -770,7 +774,7 @@ function ImageInput(props: ThemeColorProps) {
|
|||||||
value={color}
|
value={color}
|
||||||
onChange={(value: string) => {
|
onChange={(value: string) => {
|
||||||
onChange(
|
onChange(
|
||||||
`url(${image}) ${POSITION_MAP[position]} / ${mode} ${value}`
|
`url(${image}) ${POSITION_MAP[position]} / ${mode} ${value || ''}`
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user