提供屏幕比例,是否全面屏,dpr,刷新率等的静态hook
function useStatic(): {
rate: number
isFullScreen: boolean
dpr: number
updateInterval: number
}
- rate — 屏幕宽高比
- isFullScreen — 屏幕是否全面屏
- dpr — 屏幕dpr
- updateInterval — 屏幕刷新率
import { useStatic, useStore } from 'chooks'
export default {
setup(prop:any, context:SetupContext){
//静态hook,可用于全局设置
const { isFullScreen, dpr } = useStatic()
const { state, commit } = useStore(context)
commit("setGlobalSetting" ,{
isFullScreen: isFullScreen,
dpr: dpr,
})
return {
isFullScreen, dpr
}
}
}