Skip to content

Commit

Permalink
fix(Icon): 修复type异常时, Icon展示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
lingting committed Oct 21, 2021
1 parent f829d38 commit c7c3df9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const converTypeToIconPath = (type: string) => {

const Icon: React.FC<IconProps> = (props: IconProps) => {
const { type } = props;

// type 值异常
if (!type || type.length === 0) {
return <></>;
}

const IconType = allIcon[converTypeToIconPath(type)];

return IconType ? (
Expand Down

0 comments on commit c7c3df9

Please sign in to comment.