图片不存在或者路径不存在
import defaultImg from "./default.jpg";
const { picUrl} = props.item;
const [imgSrc, handleImageErrored] = useState(picUrl);
<img onError={() => handleImageErrored(defaultImg)} src={imgSrc} />
原文:https://www.cnblogs.com/yixiaoyang-/p/14667422.html