我正在构建一个 React 博客,但我的图片无法加载。它在控制台中向我显示此消息 - src\components\BlogPost\index.js
src/test/resources/application-test.yml
我的来源:
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.
请帮忙。谢谢。
答案 0 :(得分:0)
<img src="example" aria-hidden alt="Picture of me taking a photo of an image" />
添加“咏叹调隐藏”
答案 1 :(得分:0)
对图片使用准确的描述,或对背景和装饰使用 alt=""
。
import logo from '../static/logo.png';
export default function Navbar() {
return (
<img src={logo} alt='website logo' />
)
}