From a99d7763d6e49f8aae3b6f7b244209d48038125a Mon Sep 17 00:00:00 2001 From: eya46 <61458340+eya46@users.noreply.github.com> Date: Sat, 27 Apr 2024 22:10:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96props.src=E5=88=A4=E6=96=AD?= =?UTF-8?q?=20||=20Optimize=20props.src=20judgment=20(#223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化props.src判断 --- client/packages/design/components/AvatarWithPreview/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/packages/design/components/AvatarWithPreview/index.tsx b/client/packages/design/components/AvatarWithPreview/index.tsx index 5837f2c9d28..1db0af793e8 100644 --- a/client/packages/design/components/AvatarWithPreview/index.tsx +++ b/client/packages/design/components/AvatarWithPreview/index.tsx @@ -1,11 +1,12 @@ import React, { useState } from 'react'; import { Avatar, AvatarProps } from '../Avatar'; import { Image, imageUrlParser } from '../Image'; +import { isValidStr } from '../utils'; export const AvatarWithPreview: React.FC = React.memo((props) => { const [visible, setVisible] = useState(false); - const hasImage = typeof props.src === 'string'; + const hasImage = isValidStr(props.src); return ( <>