ionic項目在使用ionic build browser或者打包ios時如果設置頭部高度
方法如下
.bar-header { padding: 0; height: 0; } .scroll-content { top: 0; }
更改之后在安卓和ionic serve下界面顯示正常,但是在生成網頁或者ios打開時,顯示錯版,原因是因為設置的header頭部無效造成的,
查看源代碼可以看到設置的樣式被如下樣式覆蓋
.platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader)
解決方法,在run內部的$ionicPlatform.ready中添加ionic.Platform.fullScreen();
參考文檔:
https://forum.ionicframework.com/t/ios-header-size-is-too-large/16127