Ionic2 如何在Ionic 2中检测用户设备的大小

Ionic2 如何在Ionic 2中检测用户设备的大小,ionic2,size,screen,device,platform,Ionic2,Size,Screen,Device,Platform,基本上我想写一个函数来检测设备的大小 例如: 三星S6、S7、S8将不允许使用该功能,因为它们的尺寸不大,如iPad或三星Tab。您可以使用该功能 import { Platform } from 'ionic-angular'; constructor(public platform: Platform) public myFunction(){ if(this.platform.is('tablet'){ //execute function } } 希望这有帮助

基本上我想写一个函数来检测设备的大小

例如: 三星S6、S7、S8将不允许使用该功能,因为它们的尺寸不大,如iPad或三星Tab。

您可以使用该功能

import { Platform } from 'ionic-angular';

constructor(public platform: Platform)

public myFunction(){
  if(this.platform.is('tablet'){
    //execute function
  }
}
希望这有帮助