我正在建立一个react博客,但我的图片无法加载。它在console - src\components\BlogPost\index.js中显示此消息
Line 21:11: Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the alt prop jsx-a11y/img-redundant-alt. 我的消息来源:
const BlogPost = (props) => {
return(
<div className="blogPostContainer">
<Card>
<div className="blogHeader">
<span className="blogCategory">Featured</span>
<h1 className="postTitle">..</h1>
<span className="postedBy">..</span>
</div>
<div className="postimageContainer">
<img src={require('../../blogPostimages/memories-from.jpg')} alt="Post image" />
</div>
</Card>
</div> )
}请帮帮忙。谢谢。
发布于 2021-02-23 07:09:24
<img src="example" aria-hidden alt="Picture of me taking a photo of an image" /> 添加"aria-hidden“
发布于 2021-02-23 07:32:53
对图像使用准确的描述,或者对背景和装饰使用alt=""。
import logo from '../static/logo.png';
export default function Navbar() {
return (
<img src={logo} alt='website logo' />
)
}https://stackoverflow.com/questions/66324711
复制相似问题