【问题标题】:Ionic 3 navPush from JSON Array来自 JSON 数组的 Ionic 3 navPush
【发布时间】:2017-12-06 06:23:50
【问题描述】:

我的 Ionic 应用程序中有一个根页面,它是从 JSON 文件构建的。我需要在数组中放置一个页面对象并让 navPush 选择器获取该值,但它不起作用。如果我将页面硬编码到 navPush 中,它可以工作,但从 JSON 中提取时则不行。

列表页

...
<ion-row class="grid-categories">
  <ion-col width-50 class="category-item" *ngFor="let category of listing.categories">
    <background-image class="category-heading" [src]="category.image" [navPush]="category.page">
      <ion-row class="heading-row">
        <ion-col no-padding width-100>
          <h2 class="category-title">{{category.title}}</h2>
        </ion-col>
      </ion-row>
    </background-image>
  </ion-col>
</ion-row>
...

category.imagecategory.title 可以正常工作,但category.page 不行 - 如果我删除 category.page 并添加 aboutPage,它可以工作,但当然所有链接都会到达 aboutPage。

listing.json

...
"categories": [
    {
        "title": "About MSNVM",
        "image": "./assets/images/listing/200x200basquet.png",
        "page": "aboutPage"
    },
    {
        "title": "Plaque Locator",
        "image": "./assets/images/listing/200x200boxeo.png",
        "page": "aboutPage"
    },
    {
        "title": "Make A Donation",
        "image": "./assets/images/listing/200x200crossfit.png",
        "page": "aboutPage"
    },
    {
        "title": "Visit Memorial",
        "image": "./assets/images/listing/200x200futbol.png",
        "page": "aboutPage"
    }

]
...

【问题讨论】:

    标签: ionic-framework ionic3


    【解决方案1】:

    不应该是"page": "AboutPage"吗? (类名大写A)

    【讨论】:

      猜你喜欢
      • 2018-02-13
      • 1970-01-01
      • 1970-01-01
      • 2018-02-23
      • 1970-01-01
      • 2017-12-29
      • 2019-01-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多