javascript - 图像在下一个 js 中不起作用。给出错误“主机名”
问题描述
使用下一个 js Image 时,会出现错误
next.config.js:
module.exports = {
images: {
domains: ['localhost'],
},
};
我真的不明白如何设置 img 以及下一个 js 想从我这里得到什么
图片组件代码:
<Image
alt={element.show_name_eng}
src={'\\' + element.show_picture_1980} - throws an error if not - //
but it works without problems if you use picture + source
width={200}
height={100}/>
解决方案
您应该在此代码中添加图像的基本 URL
module.exports = {
images: {
domains: ['localhost','https://example.cm'],
},
};
推荐阅读
- python - 如何让机器人响应我在电报财务股票中的订单?
- node.js - 量角器中很少有测试失败,出现 199 错误
- intellij-idea - 禁用日志记录到 IntelliJ 控制台并改用日志文件
- python - 客户端正在使用不受支持的 Socket.IO 或 Engine.IO 协议版本错误
- ios - PersonalityQuiz guided app in swift fundamentals
- python - 使用 BeautifulSoup 创建列表
- sql - 提高 SQL Server 中最新记录的选择和插入性能
- json - 如何以编程方式单击此网页按钮
- javascript - 我想将一个值推送到一个数组然后发出警报,但什么都没有显示?
- javascript - 在 iOS 中更改内容后,触摸保持在屏幕上