【发布时间】:2018-07-04 10:34:43
【问题描述】:
我正在使用 ngStyle 设置背景图片,如下所示:
<section [ngStyle]="{'background': 'url(' + backgroundUrl + ') no-repeat 0 0 / cover'}" class="slider flex-center">
在 .ts 文件中:
this.backgroundUrl = this.homeModelResponse.featuredStories[0].fullHDUrl;
问题是,如果用户上传相同的图片,我会得到这样的网址:
https://..something/264/2970/7745/9960/rawpixel-com-256641_(1)_org_hd_ready.jpg.jpg
(1) 在括号中,我的猜测是 css 不能很好地处理它,所有其他图像都会显示,但只有具有这种类型路径的副本不是。
它适用于 img 标签,但不适用于 css 中的背景属性。
有谁知道怎么回事?
【问题讨论】: