This commit is contained in:
shaoyongjun 2024-10-31 21:07:42 +08:00
parent 3535839f16
commit 41a1a867fc
2 changed files with 27 additions and 1 deletions

View File

@ -299,7 +299,10 @@ export class MyUtils {
console.log("curClientW :", curClientW, "designWidth: ", designWidth, "-> ", nowFrontSize);
let testDiv = document.getElementById("testDevice")
testDiv.innerText = testDiv.innerText +
"\n isMobile :" + /Mobi|Android|iPhone/i.test(navigator.userAgent) +
"\n navigator_userAgent :" + navigator.userAgent.toLocaleLowerCase() +
"\n isMobile :" + /mobi|android|iphone|ipad|ipod/i.test(navigator.userAgent.toLocaleLowerCase()) +
"\n isIOS :" + /iphone|ipad|ipod/.test(window.navigator.userAgent.toLocaleLowerCase()) +
"\n isAndroid :" + /android/.test(window.navigator.userAgent.toLocaleLowerCase()) +
"\n curClientW :" + curClientW +
" \n designWidth: " + designWidth +
"\n -> " + nowFrontSize

View File

@ -20,6 +20,12 @@ import {MyEventListener} from "./event/MyEventListener.js";
* ctx
*/
ctx: {
/**
* 是否是手机端
*/
isMobile: /mobi|android|iphone|ipad|ipod/i.test(navigator.userAgent.toLocaleLowerCase()),
isIOS: /iphone|ipad|ipod/.test(window.navigator.userAgent.toLocaleLowerCase()),
isAndroid: /android/.test(window.navigator.userAgent.toLocaleLowerCase()),
/**
* 默认body front-size 单位px
@ -163,5 +169,22 @@ window.onload = function () {
console.log("mousedown: ", event)
window.myEdit.utils.ProhibitDefaultEvent(event);
}, false);
/**
* 监听手机键盘
*/
if (window.myEdit.ctx.isMobile) {
if (window.myEdit.ctx.isIOS) {
// window.addEventListener("")
} else if (window.myEdit.ctx.isAndroid) {
}
setTimeout(() => {
this.keyBoardHeight = window.innerHeight - window.visualViewport.height;
console.log("mobile: ", this.keyBoardHeight)
}, 800);
}
}