Skip to content

Commit

Permalink
Merge pull request #11501 from CheshireJCat/feat-carousel-option-supp…
Browse files Browse the repository at this point in the history
…ort-itemScheama

feat: 轮播图option 支持 itemSchema
  • Loading branch information
allenve authored Jan 13, 2025
2 parents 4828cec + 224fb5b commit f927bae
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/amis/src/renderers/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -686,20 +686,24 @@ export class Carousel extends React.Component<CarouselProps, CarouselState> {
: {})
}
: {};
const itemRender = (option: any) =>
render(
const itemRender = (option: any) => {
const {itemSchema: optionItemSchema, ...restOption} = option;
return render(
`${current}/body`,
itemSchema ? itemSchema : (defaultSchema as any),
optionItemSchema || itemSchema
? optionItemSchema || itemSchema
: (defaultSchema as any),
{
thumbMode: this.props.thumbMode,
data: createObject(
data,
isObject(option)
? option
? restOption
: {item: option, [name!]: option}
)
}
);
};

return (
<div
Expand Down

0 comments on commit f927bae

Please sign in to comment.