|
|
@@ -5,6 +5,7 @@ import { useUserStore } from './userStore'
|
|
|
import Taro from '@tarojs/taro'
|
|
|
export interface AppState {
|
|
|
value: number
|
|
|
+ ratio: number
|
|
|
headerHeight: number
|
|
|
screenHeight: number
|
|
|
windowWidth: number
|
|
|
@@ -27,6 +28,7 @@ export interface AppState {
|
|
|
|
|
|
export const useAppStore = create<AppState>((set) => ({
|
|
|
value: 0,
|
|
|
+ ratio: 1, // 750 / windowWidth 宽高比
|
|
|
topDistance: 0, // 内容距离顶部的距离
|
|
|
headerHeight: 0, // 头部高度
|
|
|
screenHeight: 0, // 屏幕高度
|
|
|
@@ -73,6 +75,7 @@ export const useAppStore = create<AppState>((set) => ({
|
|
|
const screenHeight = info.screenHeight
|
|
|
const windowWidth = info.windowWidth
|
|
|
const windowHeight = info.windowHeight // 更精确的可用高度(减去状态栏等)
|
|
|
+ const ratio = 750 / windowWidth
|
|
|
|
|
|
// 导航栏高度 = 胶囊和状态栏之间的留白 * 2 胶囊高度
|
|
|
let navbarHeight = (capsuleInfo.top - statusBarHeight) * 2 + capsuleInfo.height
|
|
|
@@ -94,7 +97,7 @@ export const useAppStore = create<AppState>((set) => ({
|
|
|
}
|
|
|
|
|
|
|
|
|
- set({ systemInfo: info, capsuleInfo, statusBarHeight, headerHeight, isIos, desktopPopupTips, bottomSafeHeight, screenHeight, windowHeight, windowWidth})
|
|
|
+ set({ systemInfo: info, capsuleInfo, statusBarHeight, headerHeight, isIos, desktopPopupTips, bottomSafeHeight, screenHeight, windowHeight, windowWidth, ratio})
|
|
|
|
|
|
|
|
|
},
|