12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <script>
- import Vue from 'vue'
-
- export default {
- onLaunch: function() {
- uni.getSystemInfo({
- success: function (res) {
- Vue.prototype.screenHeight=res.screenHeight
- Vue.prototype.screenWidth=res.screenWidth
- if (uni.getMenuButtonBoundingClientRect()) {
- console.log('小程序');
-
- thisWechat(res.statusBarHeight)
- }else{
- console.log('app');
- thisApp(res.statusBarHeight)
- }
- }
- });
-
- function thisWechat(statusBarHeight){
-
-
- let meunButtonInfo=uni.getMenuButtonBoundingClientRect()
-
-
- Vue.prototype.meunButtonInfo=meunButtonInfo.height
-
-
- let allHeight = meunButtonInfo.bottom + (meunButtonInfo.top - statusBarHeight )*2;
-
- let navheight;
- Vue.prototype.navheight=allHeight
-
-
- let alltop = meunButtonInfo.top
- Vue.prototype.navTop=alltop
-
-
- let statusHeight
- Vue.prototype.statusHeight=statusBarHeight
- };
-
- function thisApp(statusBarHeight){
-
-
-
-
-
- let customBarHeight;
- if (uni.getSystemInfoSync().platform === 'android') {
-
- customBarHeight = statusBarHeight + 50;
-
- } else if (uni.getSystemInfoSync().platform === 'ios') {
-
-
-
- customBarHeight = statusBarHeight + 45;
- } else {
-
-
- customBarHeight = statusBarHeight;
- }
-
- Vue.prototype.customBar = customBarHeight;
- }
-
- },
- onLoad() {
-
- }
- }
- </script>
- <style>
-
- body{
- background-color: #f0f2f5;
- }
- view{
- box-sizing: border-box;
- padding: 0;
- }
- </style>
|