Skip to content

Commit a99d776

Browse files
authored
优化props.src判断 || Optimize props.src judgment (#223)
优化props.src判断
1 parent fe6f5ea commit a99d776

File tree

1 file changed

+2
-1
lines changed
  • client/packages/design/components/AvatarWithPreview

1 file changed

+2
-1
lines changed

client/packages/design/components/AvatarWithPreview/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, { useState } from 'react';
22
import { Avatar, AvatarProps } from '../Avatar';
33
import { Image, imageUrlParser } from '../Image';
4+
import { isValidStr } from '../utils';
45

56
export const AvatarWithPreview: React.FC<AvatarProps> = React.memo((props) => {
67
const [visible, setVisible] = useState(false);
78

8-
const hasImage = typeof props.src === 'string';
9+
const hasImage = isValidStr(props.src);
910

1011
return (
1112
<>

0 commit comments

Comments
 (0)