| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { defineStore } from 'pinia'; |
| | | import { store } from '@/stores'; |
| | | import { isWeb } from '@/utils/env'; |
| | | |
| | | export interface Options { |
| | | path: string; |
| | |
| | | this.screenWidth = info.screenWidth; |
| | | |
| | | this.IPhoneXPadding = info.screenHeight - info.safeArea.bottom; |
| | | this.navHeight = info.statusBarHeight + this.navigationBarHeight; |
| | | this.navHeight = (info.statusBarHeight || 0) + this.navigationBarHeight; |
| | | |
| | | this.safeAreaTop = info.safeArea.top; |
| | | |
| | |
| | | */ |
| | | this.bottomNavHeight = 118 * scale; |
| | | |
| | | this.pageHeight = info.screenHeight - this.navHeight - this.IPhoneXPadding; // 无底部tabber |
| | | this.pageHeight = info.screenHeight - this.navHeight - (isWeb ? 0 : this.IPhoneXPadding); // 无底部tabber |
| | | this.pageHeightWithTab = this.pageHeight - this.bottomNavHeight; // 有底部tabber |
| | | }, |
| | | |
| | | setNavigationBarHeight(systemInfo: Taro.getSystemInfoSync.Result) { |
| | | const { right, height, width, top } = Taro.getMenuButtonBoundingClientRect(); |
| | | try { |
| | | if (!isWeb) { |
| | | const { right, height, width, top } = Taro.getMenuButtonBoundingClientRect(); |
| | | |
| | | let navigationBarHeight = 0; |
| | | this.menuButtonHeight = height; |
| | | this.menuButtonWidth = width; |
| | | this.menuButtonTop = top; |
| | | this.menuButtonRightDistance = systemInfo.screenWidth - right; |
| | | } |
| | | let navigationBarHeight = 0; |
| | | |
| | | if (systemInfo.platform === 'android') { |
| | | navigationBarHeight = 48; |
| | | } else { |
| | | navigationBarHeight = 44; |
| | | } |
| | | this.menuButtonHeight = height; |
| | | this.menuButtonWidth = width; |
| | | this.menuButtonTop = top; |
| | | this.menuButtonRightDistance = systemInfo.screenWidth - right; |
| | | this.navigationBarHeight = navigationBarHeight; |
| | | if (systemInfo.platform === 'android') { |
| | | navigationBarHeight = 48; |
| | | } else { |
| | | navigationBarHeight = 44; |
| | | } |
| | | this.navigationBarHeight = navigationBarHeight; |
| | | } catch (error) {} |
| | | }, |
| | | |
| | | setTabIndex(tabIndex: number) { |