css - Ionic 3 - ionic 滑动内联 CSS

标签 css angular typescript sass ionic3

我在主页上有 Ionic3 App 和 ion-slides 组件。

<ion-slides pager>
    <ion-slide *ngFor="let blog of blogs | async" >
      <h2>{{ blog.title }}</h2>
      <p>
      <a target="_blank" class="slider-read-more" ion-button outline color="secondary" (click)="blogDetail(blog)">ვრცლად</a>
      </p>
    </ion-slide>
  </ion-slides>

我想使用样式添加内联 css 背景图片

<ion-slide *ngFor="let blog of blogs | async" style="background:url(blog.image) no-repeat center center fixed;">

但是里面不能传blog.image。如何做到这一点?

最佳答案

您可以尝试如下所示:

即使用 backgroundImage 作为属性绑定(bind):

 <ion-slide [style.backgroundImage]="'url(' + blog.image + ')'"> ...

关于css - Ionic 3 - ionic 滑动内联 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46424608/

相关文章:

javascript - 灯箱图片比灯箱本身大

html - 如何将所有内容都放在导航栏下

testing - 带有 webpack 的 Angular 2 获取未捕获的 ReferenceError : System is not defined

Angular 6 : error TS2315: Type 'ModuleWithProviders' is not generic

jquery - 获取滚动条的颜色

javascript - Nivo slider 加载问题?

angular - 错误 TS2339 : Property 'loading' does not exist on type 'DiseaseListComponent'

angular - 错误 - 如果 : The results are not as expected

Typescript `in` 运算符类型保护仅作为文字缩小

reactjs - 如何在 TypeScript 中向 super React 组件添加 Prop ?