嘗試從 div 中的服務器動態加載影像,但無法這樣做:
<div class="thumb" style="background-image: url('https://www.abcd.com/ post.image)"></div>
我已經嘗試過片段,但它們在這篇文章中不起作用Angular dynamic background images
uj5u.com熱心網友回復:
如果你想動態使用。不要使用這種語法
<div class="thumb" style="background-image: url('https://www.abcd.com/ post.image)"></div>
嘗試這樣做
<div class="thumb" [ngStyle]="{'background-image': 'url(' post.imageURL ')'}" > <div>
希望這會有所幫助。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/353044.html
下一篇:活動下拉選單
