【发布时间】:2019-11-20 22:34:30
【问题描述】:
您好,我想在 img 上添加样式 opacity:0.3
<ion-content [style]="getBackgroundImg()">
getBackgroundImg() {
const img = this.mediaDetails.image_path;
const style = `background-image: url(${img}); `;
return this.sanitizer.bypassSecurityTrustStyle(style);
}
注意:我只想将不透明度放在 const img 上,而不是放在整个离子含量上。它不需要对象中的不透明度
【问题讨论】:
-
mediaDetails: any = {}; this.mediaDetails.image_path['opacity'] = "0.4";我得到'无法在字符串上创建属性不透明度'
-
您想在 ion-content 中为图像添加不透明度?还是背景?
-
在背景上,不是离子内容,因为我有内容按钮,数据等
标签: ionic-framework