作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在electronJs应用程序中,我试图使用动态创建的图像标签加载base64图像。使用insertAdjacentElement()方法将base64字符串附加到image标签,并将其附加到容器。我尝试使用模板字符串方法设置源,但没有成功。
当我运行该应用程序并执行添加图像的操作时。在控制台中,我得到了错误:
无法加载资源:net::ERR_FILE_NOT_FOUND
我尝试了许多base64字符串,但这始终是结果。
const imgTemplate: HTMLImageElement = document.createElement('img') as HTMLImageElement;
imgTemplate.src = base64; // declared variable container base64 string
if(this._appThumbnailContainer) {
this._appThumbnailContainer.insertAdjacentElement('beforeend', imgTemplate)
}
最佳答案
似乎您在src字符串中有一个额外的引号(src="'
),请重新检查base64
变量的内容。
关于html - ElectonJs base64 image src-无法加载资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59813033/
在electronJs应用程序中,我试图使用动态创建的图像标签加载base64图像。使用insertAdjacentElement()方法将base64字符串附加到image标签,并将其附加到容器。我
我是一名优秀的程序员,十分优秀!