最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

ElectonJs base64 image src

IT培训 admin 13浏览 0评论

ElectonJs base64 image src

在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)
                    }

下面是DOM中html的屏幕。

回答如下:

ElectonJs base64 image src

在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)
                    }

下面是DOM中html的屏幕。

回答如下:

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论