mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-15 17:31:18 +08:00
amis-saas-7927 [Bug] 「外观配置」背景配置项功能异常
Change-Id: Id8bbd155b11ea40fea3c2bfb8d348e2e322b64bf
This commit is contained in:
parent
6e6202f688
commit
41a74f6b77
@ -361,12 +361,39 @@ const Background: React.FC<BackgroundProps> = props => {
|
||||
setTabIndex(index);
|
||||
}
|
||||
|
||||
function handleChange(key: string, keyValue: string) {
|
||||
function handleChange(key: string, keyValue: string | number) {
|
||||
const {value, onChange} = props;
|
||||
const result = {
|
||||
|
||||
let result = {};
|
||||
if (key === 'backgroundColor') {
|
||||
result = {
|
||||
...omit(value, [
|
||||
'backgroundImage',
|
||||
'backgroundPosition',
|
||||
'backgroundSize',
|
||||
'backgroundRepeat',
|
||||
'angle'
|
||||
]),
|
||||
[key]: keyValue
|
||||
};
|
||||
} else if (key === 'angle') {
|
||||
keyValue = keyValue || 0;
|
||||
const linearGradient = value?.backgroundImage;
|
||||
let backgroundImage = linearGradient?.replace(
|
||||
/(\d{1,})?deg/,
|
||||
`${keyValue}deg`
|
||||
);
|
||||
result = {
|
||||
...value,
|
||||
backgroundImage
|
||||
};
|
||||
} else {
|
||||
result = {
|
||||
...value,
|
||||
[key]: keyValue
|
||||
};
|
||||
}
|
||||
|
||||
onChange(result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user