Skip to content

Commit

Permalink
fix: select tag render
Browse files Browse the repository at this point in the history
  • Loading branch information
yinkaihui committed Jun 11, 2024
1 parent 2dbcf80 commit e074110
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions components/_class/select-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,19 @@ const CoreSelectView = React.forwardRef(
// const maxTagCountValue = isObject(maxTagCount) ? maxTagCount.count : maxTagCount;

const maxTagCountRender = (invisibleCount) => {
const dom =
isObject(maxTagCount) && isFunction(maxTagCount.render)
? maxTagCount.render(invisibleCount)
: `+${invisibleCount}...`;

if (renderTag) {
// 执行 renderTag 逻辑。。 这里只是为了兼容以前 select-view 里会对 +x... 节点执行 renderTag 逻辑
// 可能不大合理,按理说 maxTagCount.render 就行,但这里要保持以前的行为不变。
return dom;
}

return (
<Tag className={cs(`${getPrefixCls('input-tag')}-tag`, `${prefixCls}-tag`)}>
{isObject(maxTagCount) && isFunction(maxTagCount.render)
? maxTagCount.render(invisibleCount)
: `+${invisibleCount}...`}
</Tag>
<Tag className={cs(`${getPrefixCls('input-tag')}-tag`, `${prefixCls}-tag`)}>{dom}</Tag>
);
};

Expand Down

0 comments on commit e074110

Please sign in to comment.