Skip to content

Commit

Permalink
fix: 修复自定义外观部分属性添加important不生效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qkiroc committed Nov 7, 2023
1 parent 01ccd77 commit 3a7366b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/amis-core/src/utils/style-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ export function formatStyle(
const styles: string[] = [];
const fn = (key: string, value: string) => {
key = valueMap[key] || key;
styles.push(`${kebabCase(key)}: ${value};`);
styles.push(
`${kebabCase(key)}: ${
value + (weights?.important ? ' !important' : '')
};`
);
};
Object.keys(statusMap[status]).forEach(key => {
if (key !== '$$id') {
Expand Down Expand Up @@ -191,15 +195,11 @@ export function formatStyle(
} else {
const value = style;
if (key === 'iconSize') {
fn('width', value + (weights?.important ? ' !important' : ''));
fn('height', value + (weights?.important ? ' !important' : ''));
fn(
'font-size',
value + (weights?.important ? ' !important' : '')
);
fn('width', value);
fn('height', value);
fn('font-size', value);
} else {
value &&
fn(key, value + (weights?.important ? ' !important' : ''));
value && fn(key, value);
}
}
}
Expand Down

0 comments on commit 3a7366b

Please sign in to comment.