mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-09 13:30:46 +08:00
Revert "feat: handle ios safari keyboard"
This reverts commit 9b31df28aa.
This commit is contained in:
@@ -12,7 +12,6 @@ import { checkToken, clearToken, isLogin } from './utils/auth'
|
|||||||
import { loginWithGoogle } from './utils/google'
|
import { loginWithGoogle } from './utils/google'
|
||||||
import { initTheme } from './utils/theme'
|
import { initTheme } from './utils/theme'
|
||||||
import { clearVditorStorage } from './utils/clearVditorStorage'
|
import { clearVditorStorage } from './utils/clearVditorStorage'
|
||||||
import { initIOSKeyboardFix } from './utils/iosKeyboardFix'
|
|
||||||
|
|
||||||
// 采用本地开发环境
|
// 采用本地开发环境
|
||||||
// export const API_DOMAIN = 'http://127.0.0.1'
|
// export const API_DOMAIN = 'http://127.0.0.1'
|
||||||
@@ -35,7 +34,6 @@ export const toast = useToast()
|
|||||||
|
|
||||||
initTheme()
|
initTheme()
|
||||||
clearVditorStorage()
|
clearVditorStorage()
|
||||||
initIOSKeyboardFix()
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
app.use(router)
|
app.use(router)
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
export function initIOSKeyboardFix() {
|
|
||||||
if (typeof window === 'undefined' || !window.visualViewport) return;
|
|
||||||
|
|
||||||
const ua = navigator.userAgent || '';
|
|
||||||
const isIOS = /iP(ad|hone|od)/.test(ua);
|
|
||||||
if (!isIOS) return;
|
|
||||||
|
|
||||||
const viewport = window.visualViewport;
|
|
||||||
const adjustScroll = () => {
|
|
||||||
window.scrollTo(0, viewport.offsetTop);
|
|
||||||
};
|
|
||||||
|
|
||||||
viewport.addEventListener('resize', adjustScroll);
|
|
||||||
viewport.addEventListener('scroll', adjustScroll);
|
|
||||||
|
|
||||||
let lastScrollY = 0;
|
|
||||||
document.addEventListener('focusin', () => {
|
|
||||||
lastScrollY = window.scrollY;
|
|
||||||
});
|
|
||||||
document.addEventListener('focusout', () => {
|
|
||||||
window.scrollTo(0, lastScrollY);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user