gpt4 book ai didi

reactjs - "Redundant alt attribute. Screen-readers already announce ` img ` tags as an image."代码错误

转载 作者:行者123 更新时间:2023-12-05 08:25:12 25 4
gpt4 key购买 nike

我输入了 <img src= {'https://robohash.org/${id}?size=300x300'}alt="photo" />在我的 React js 文件上,保存文件后,我在 GitBash 上收到一条错误消息,说,

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

然后我删除了 alt从代码中,我收到错误消息,

img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text

我该如何解决这个问题?

最佳答案

不同于单词“照片”和“图像”(或任何指定的自定义单词)的“东西”。

关于reactjs - "Redundant alt attribute. Screen-readers already announce ` img ` tags as an image."代码错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67448468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com