feat: handle basic routes (#1784)

This commit is contained in:
Mo
2022-10-13 09:08:03 -05:00
committed by GitHub
parent 794ed7f7d4
commit 3cb016ab1f
27 changed files with 391 additions and 140 deletions

View File

@@ -0,0 +1,24 @@
import { isDev } from '@/Utils'
export const ViewportHeightKey = '--viewport-height'
export const setViewportHeightWithFallback = () => {
const currentHeight = parseInt(document.documentElement.style.getPropertyValue(ViewportHeightKey))
const newValue = visualViewport && visualViewport.height > 0 ? visualViewport.height : window.innerHeight
if (isDev) {
// eslint-disable-next-line no-console
console.log(`currentHeight: ${currentHeight}, newValue: ${newValue}`)
}
if (currentHeight && newValue < currentHeight) {
return
}
if (!newValue) {
document.documentElement.style.setProperty(ViewportHeightKey, '100vh')
return
}
document.documentElement.style.setProperty(ViewportHeightKey, `${newValue}px`)
}