【问题标题】:How to change div background image in ionic如何在离子中更改div背景图像
【发布时间】:2022-10-01 23:56:27
【问题描述】:
<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]

    标签: angular ionic-framework ng-style


    【解决方案1】:

    请试试这个

    <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多