如何在ionic中更改div背景图像

o75abkj4  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(131)
<div class="col m-2 image row"
    *ngFor="let aa of activiteAvenir" [ngStyle]="{'background-image':url(' +aa.image+ ')}"
     style=" background-repeat: no-repeat;   background-position: center; background- 
     size: cover; border-radius: 10px;">

</div>

我试过很多没用的东西,我真的不需要它;在某些情况下,ng样式会给我[object object]

2w2cym1i

2w2cym1i1#

请试试这个

<div class="col m-2 image row"
    *ngFor="let aa of activiteAvenir" [ngStyle]="{'background-image':'url('+ aa.image +')'}"
     style=" background-repeat: no-repeat;   background-position: center; background- 
     size: cover; border-radius: 10px;">

</div>

相关问题