我正在尝试对网络和设备使用相同的 html,并且在某些情况下我需要显示/隐藏网络 html 或设备 html。
showWhen 在哪里和 hideWhen Ionic 4 中的指令?如果它们消失了,是否已被其他东西取代?
到目前为止,我能找到的是 some test page但这并没有说明什么。
最佳答案
为了将我的应用程序升级到 ionic 4,我使用了这个替代方案 https://ionicframework.com/docs/utilities/platform根据设备的操作系统显示正确的按钮,效果很好而且很容易实现:
import { Component, OnInit} from '@angular/core';
import { Platform } from '@ionic/angular';
@Component({
selector: 'update-password',
templateUrl: './update-password.component.html'
})
export class UpdatePasswordComponent implements OnInit {
constructor(
public platform: Platform
) { }
<ion-header>
<ion-toolbar>
<ion-title>Update Password</ion-title>
<ion-buttons slot="start">
<ion-button (click)="dismiss()">
<ion-text color="primary" *ngIf="platform.is('ios')">Cancel</ion-text>
<ion-icon name="md-close" *ngIf="!platform.is('ios')"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
关于html - Ionic 4 showWhen hideWhen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53248964/