В настоящее время я работаю над приложением ionc4, и мне нужно использовать этот плагин для пролистывания вкладок. Панель инструментов плагина работает отлично, пока я использую статические данные. Однако всякий раз, когда я выбираю данные через сервер, он перестает показывать раздел панели инструментов (вкладки). С другой стороны, он показывает содержание всех вкладок. и что примечательно, что я использую последнюю версию, которая ionic-super-tabs / angular ":" ^ 6.0.0-beta.8
Статические данные: сторона HTML и все работает
<ion-header>
<ion-toolbar>
<ion-title>NextOrderPage</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<super-tabs (tabChange)="onTabChange($event)">
<super-tabs-container >
<super-tab>
<h1>Home Content</h1>
</super-tab>
<super-tab>
<h1>About Content</h1>
</super-tab>
<super-tab>
<h1>Setting Content</h1>
</super-tab>
</super-tabs-container>
<super-tabs-toolbar slot="top">
<super-tab-button>
<ion-label>Home</ion-label>
</super-tab-button>
<super-tab-button>
<ion-label>About</ion-label>
</super-tab-button>
<super-tab-button>
<ion-label>Setting</ion-label>
</super-tab-button>
</super-tabs-toolbar>
</super-tabs>
</ion-content>
Статические данные: машинописная сторона и все работает
import { Component, OnInit, ViewChild } from "@angular/core";
import { SuperTabs } from "@ionic-super-tabs/angular";
@Component({
selector: "app-next-order-page",
templateUrl: "./next-order-page.page.html",
styleUrls: ["./next-order-page.page.scss"]
})
export class NextOrderPagePage implements OnInit {
@ViewChild(SuperTabs) superTabs: SuperTabs;
constructor() {}
ngOnInit() {}
}
раздел динамических данных
HTML-файл с динамическими данными
<ion-header>
<ion-toolbar>
<ion-title>NextOrderPage</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="content">
<div class="menu">
مینو
</div>
<div class="category">
<super-tabs>
<super-tabs-container>
<super-tab *ngFor="let item of categories">
<div class="item" *ngFor="let food of SingleRestaurantData[item]">
<ion-grid>
<ion-row>
<ion-col size="8">
<div class="food-info">
<div class="food-name">{{ food[1] }}</div>
<div class="food-description">
{{ food[3] }}
</div>
<div class="price">افغانی {{ food[2] }}</div>
<div class="order">
<fa-icon
icon="plus-circle"
(click)="addorders(food[0])"
id="{{ food[0] }}up"
></fa-icon>
<span class="order-count" id="{{ food[0] }}span"
>0</span
>
<fa-icon
icon="minus-circle"
id="{{ food[0] }}down"
(click)="minusOrder(food[0])"
></fa-icon>
</div>
</div>
<!--end of food-info section-->
</ion-col>
<ion-col size="4">
<div
class="food-image"
[ngStyle]="{ 'background-image': 'url(' + food[4] + ')' }"
></div>
</ion-col>
</ion-row>
</ion-grid>
</div>
<!--end of div.item-->
</super-tab>
</super-tabs-container>
<super-tabs-toolbar slot="top" scrollable="true">
<super-tab-button *ngFor="let item of categories">
<ion-label>{{ item }}</ion-label>
</super-tab-button>
</super-tabs-toolbar>
</super-tabs>
</div>
<!--end of category-->
<div class="food-list"></div>
</div>
</ion-content>
машинописные файлы динамических данных
import { AlertService } from "./../../../services/alert/alert.service";
import { Component, OnInit, ViewChild } from "@angular/core";
import { SuperTabs } from "@ionic-super-tabs/angular";
import { Storage } from "@ionic/storage";
import { SingletonService } from "src/app/services/constants/single-ton.service";
import { HTTP } from "@ionic-native/http/ngx";
import { Router, ActivatedRoute } from "@angular/router";
@Component({
selector: "app-next-order-page",
templateUrl: "./next-order-page.page.html",
styleUrls: ["./next-order-page.page.scss"]
})
export class NextOrderPagePage implements OnInit {
userId: number;
restaurantId: number;
SingleRestaurantData: any;
restaurantInfo: any;
categories: any;
isFavorite: boolean = false;
unFavorite: boolean = true;
addorder: boolean = false;
count: boolean = false;
// restaurant_id: number;
favorite = false;
@ViewChild(SuperTabs) superTabs: SuperTabs;
constructor(
public storage: Storage,
public http: HTTP,
public router: Router,
private route: ActivatedRoute,
private loading: AlertService
) {
this.route.queryParams.subscribe(params => {
if (this.router.getCurrentNavigation().extras.state) {
this.restaurantId = this.router.getCurrentNavigation().extras.state.restaurant_id;
}
});
this.storage.get("user_data").then(data => {
this.userId = data[0];
console.log(this.userId);
data = { user_id: this.userId, restaurant_id: this.restaurantId };
this.http
.post(SingletonService.SinglePageRestaurant, data, {})
.then(SingleData => {
this.SingleRestaurantData = JSON.parse(SingleData.data);
this.restaurantInfo = this.SingleRestaurantData.restaurant_info;
delete this.SingleRestaurantData.restaurant_info;
this.categories = this.keys(this.SingleRestaurantData);
console.log(this.SingleRestaurantData[this.categories[0]]);
//check the favorite res
if (this.restaurantInfo[0][9] == "true") {
this.isFavorite = true;
this.unFavorite = false;
}
this.loading.dismiss();
})
.catch(error => {
console.log("error happended while geting resturant data");
console.log(error.status);
console.log(error.error);
console.log(error.headers);
});
});
//take the restaurant id with the route
}
keys(obj) {
return Object.keys(obj);
}
ngOnInit() {}
}
Примечание: я предоставил вышеуказанные файлы, пожалуйста, дайте мне знать, если мне нужно добавить больше кодов.
показать эту ошибку