🐞 fix(图片): 图片显示降级处理

This commit is contained in:
xuan 2022-11-25 15:41:00 +08:00
parent 34abf8fc7f
commit 344d77b7bc

View File

@ -48,10 +48,14 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
setLabAndImgShow(true)
}
const handleImageError = () => {
setImgs([])
}
return (
<>
<View className={styles.labAndImg_main} onClick={() => onShowLabAndImg()}>
{imgs?.length > 0 && <Image mode='aspectFill' src={imgs[0]} className={styles.labAndImg_image}></Image>}
{imgs?.length > 0 && <Image mode='aspectFill' src={imgs[0]} className={styles.labAndImg_image} onError={handleImageError}></Image>}
{!imgs?.length && rgbStyle && <View className={styles.boxColor} style={{ ...rgbStyle }}></View>}
{!imgs?.length && !rgbStyle && <Image mode='aspectFill' src={formatImgUrl('')} className={styles.labAndImg_image}></Image>}
</View>