123456789101112131415161718192021222324252627282930 |
- <script>
- export default {
- onLaunch: function() {
- // 获取设备信息
- let that = this;
- uni.getSystemInfo({
- success(res) {
- that.$systemInfo.platform = res.platform;
- that.$systemInfo.statusBarHeight = res.statusBarHeight;
- that.$systemInfo.fontSizeSetting = res.fontSizeSetting;
- if (res.platform === 'ios' || res.platform === 'devtools') {
- that.$systemInfo.navBarHeight = 44;
- } else {
- // 获取胶囊按钮信息
- let menuInfo = uni.getMenuButtonBoundingClientRect();
- // 计算导航栏高度
- that.$systemInfo.navBarHeight = menuInfo.height + (menuInfo.top - res.statusBarHeight) * 2;
- }
- }
- });
- },
- onShow: function() {},
- onHide: function() {}
- }
- </script>
- <style>
- /*每个页面公共css */
- @import './common/uni.css';
- </style>
|