gpt4 book ai didi

css - Angular 2 ngStyle 和背景图像

转载 作者:行者123 更新时间:2023-12-01 12:42:34 26 4
gpt4 key购买 nike

<分区>

我在使用 Angular 2 ngStyle 指令时遇到了很大的麻烦。我无法从 base64 编码文件设置背景图像。现在在 template.html 中我有这个:

  <div class="projects_item_wrap" [ngStyle]="{'background-image':'url('+images[i].file+')'}">

其中“图像”是 base64 编码的 .png 文件及其名称的数组。

console.log of images[3].file 给我这个(问题不在图像内部,当我在 img src='...' 中使用它时它工作得很好):

blob image

有什么想法吗?非常感谢您的回答! :)

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com