javascript - 此警告消息是什么意思? 'img elements must have an alt prop, either with meaningful text, or an empty string for decorative images'

标签 javascript reactjs

为什么我会收到此警告?

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

它显示第 13 行,但没有使用任何 Prop 。

最佳答案

这意味着当您在 HTML 中创建图像时,为了屏幕阅读器和文本浏览器的利益,您应该包含一个 alt 属性。

<img src="url" alt="description of image">

关于javascript - 此警告消息是什么意思? 'img elements must have an alt prop, either with meaningful text, or an empty string for decorative images',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43812733/

相关文章:

javascript - 单击按钮时链接到另一个 html 文档

javascript - 当用户位于页面底部时编辑 css 值

php - 文本文件和数组的文件读/写问题

javascript - 使用 JavaScript 从页面收集价格

javascript - 后台Formdata为空

javascript - 如何使用搜索框中的搜索词从 ReactJS 中的多个 URL 获取 JSON 数据?

javascript - Bootbox 回调表单提交无法正常工作

javascript - Jquery 在点击图片时切换

javascript - React.js 属性

javascript - 如何在语义 react 下拉列表中使用 onChange 方法