为什么我的html和js只有一张图片.jpg却渲染了2个图片文件

问题描述 投票:0回答:1

为什么我的html和js只有一张image.jpg却渲染了2个图片文件。

我使用带有 CSS 和 JSS 以及 Webpack 的静态 Html。

见下图:

issue showing how image is rendered

代码位于 Github:https://github.com/kevindRuby/hello-webpack-eg1

首选结果:图像在闪烁文本上方显示一次。

javascript html css webpack
1个回答
0
投票

您的 main.js 文件中有

import imageSrc from './image.jpg'; // Adjust the path if necessary

const imgElement = document.createElement('img');
imgElement.src = imageSrc;
imgElement.alt = 'Description of image';
document.body.appendChild(imgElement);
© www.soinside.com 2019 - 2024. All rights reserved.