内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
或者尝试下这个:
window.screen.width window.screen.height
可以使用:
import {Component} from '@angular/core'; import {Platform} from 'ionic-angular'; @Component({...}) export MyApp { constructor(platform: Platform) { platform.ready().then((readySource) => { console.log('Width: ' + platform.width()); console.log('Height: ' + platform.height()); }); } }