<style lang="scss"> /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */ @import "uview-ui/index.scss"; </style> <script> import Store from '@/store'; export default { globalData: { statusBarHeight: 0, // 状态导航栏高度 navHeight: 0, // 总体高度 navigationBarHeight: 0, // 导航栏高度(标题栏高度) }, onLaunch: function () { // wx.setInnerAudioOption({ // mixWithOther: true, // obeyMuteSwitch: false, // success: function (e) { // console.log(e) // console.log('play success') // }, // fail: function (e) { // console.log(e) // console.log('play fail') // } // }) Store.commit('setAuthorization', uni.getStorageSync('Authorization')) Store.commit('setUserInfo', uni.getStorageSync('userInfo')) // uni.showLoading({ // title: '加载中...', // mask:true // }); // uni.clearStorageSync(); wx.getSystemInfo({ success: res => { const BottomSafeHeight = res.screenHeight - res.safeArea.bottom uni.setStorage({ key: 'BottomSafeHeight', data: BottomSafeHeight?BottomSafeHeight:0 }); } }) // 状态栏高度 this.globalData.statusBarHeight = uni.getSystemInfoSync().statusBarHeight // #ifdef MP-WEIXIN // 获取微信胶囊的位置信息 width,height,top,right,left,bottom const custom = wx.getMenuButtonBoundingClientRect() // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2 this.globalData.navigationBarHeight = custom.height + (custom.top - this.globalData.statusBarHeight) * 2 // console.log("导航栏高度:"+this.globalData.navigationBarHeight) // 总体高度 = 状态栏高度 + 导航栏高度 this.globalData.navHeight = this.globalData.navigationBarHeight + this.globalData.statusBarHeight // #endif }, onShow: function () { }, onHide: function () { }, } </script> <style lang="scss"> /*每个页面公共css */ .pages { background: #F2F2F2; min-height: 100vh; } .uni-tabbar { // tab 样式 // 背景色 background-color: rgba(57, 181, 74, 0.1) !important; // tabBar 样式 // 上边框 .uni-tabbar-border { background-color: #e54d42 !important; // tabBar 上边框的颜色 } .uni-tabbar__item { // tabBar 单项样式 height: 100rpx !important; &:not(:last-child) { border-right: 4rpx solid #eee; } .uni-tabbar__icon { // tabBar 图标样式 width: 40rpx !important; height: 40rpx !important; } .uni-tabbar__label { // tabBar 文字样式 // color:yellow !important } } } * { box-sizing: border-box; } image { width: 100%; height: auto; } </style>