Skip to content

Commit

Permalink
fix: 修复 card 组件渲染异常 Close: #10229
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed May 17, 2024
1 parent 3eacf02 commit 6bf2de5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions packages/amis-core/src/utils/style-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,12 @@ export function insertEditCustomStyle(params: {

insertStyle({
style: content,
classId: 'wrapperCustomStyle-' + (id?.replace('u:', '') || uuid()) + index,
classId:
'wrapperCustomStyle-' +
((typeof id === 'string' ? id.replace('u:', '') : '') || uuid()) +
index,
doc,
id: id?.replace('u:', '').replace(/(-.*)/, '')
id: typeof id === 'string' ? id.replace('u:', '').replace(/(-.*)/, '') : ''
});
}

Expand All @@ -475,6 +478,10 @@ export function removeCustomStyle(
doc?: Document,
data?: any
) {
if (typeof id !== 'string') {
debugger;
}

let styleId = 'amis-' + (type ? type + '-' : '') + id.replace('u:', '');
if (typeof data?.index === 'number') {
styleId += `-${data.index}`;
Expand Down
6 changes: 5 additions & 1 deletion packages/amis/src/renderers/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ export class CardRenderer extends React.Component<CardProps> {
const {subTitle: subTitleTpl} = header || {};

// const subTitle = filter(subTitleTpl, data);
return subTitleTpl ? render('sub-title', subTitleTpl, data) : undefined;
return subTitleTpl
? render('sub-title', subTitleTpl, {
data
})
: undefined;
}
return;
}
Expand Down

0 comments on commit 6bf2de5

Please sign in to comment.