This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
App.vue
70 lines (67 loc) · 2.11 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<script>
export default {
globalData: {
// 胶囊距上距离
menuTop: 0,
// 导航栏高度
navBarHeight: 0,
// 胶囊距右方间距(方保持左、右间距一致)
menuRight: 0,
// 胶囊距底部间距(保持底部间距一致)
menuBotton: 0,
// 胶囊高度(自定义内容可与胶囊高度保证一致)
menuHeight: 0,
// 状态栏高度
statusBarHeight: 0,
// 安全距离
safeAreaHeight: 0,
// 胶囊宽度
menuWidth: 0
},
onLaunch(options) {
const that = this;
// 获取系统信息
const systemInfo = uni.getSystemInfoSync();
// 胶囊按钮位置信息
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
// 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
that.globalData.menuTop = menuButtonInfo.top - systemInfo.statusBarHeight;
that.globalData.menuWidth = menuButtonInfo.width;
that.globalData.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight;
that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
that.globalData.menuBotton = menuButtonInfo.top - systemInfo.statusBarHeight;
that.globalData.menuHeight = menuButtonInfo.height;
that.globalData.statusBarHeight = systemInfo.statusBarHeight;
that.globalData.safeAreaHeight = systemInfo.safeAreaInsets.bottom;
}
};
</script>
<style lang="scss">
// ===
// === 注意:此处导入的css,会作用于全部.vue文件,请适量导入
// ===
@import 'uview-ui/index.scss';
/* 解决小程序和app滚动条的问题 */
/* #ifdef MP-WEIXIN || APP-PLUS */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
/* #endif */
/* 解决H5 的问题 */
/* #ifdef H5 */
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
/* #endif */
</style>