-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81f1bf5
commit 577f530
Showing
5 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export default function () { | ||
const u = navigator.userAgent; | ||
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端 | ||
const classList = 'input'; | ||
setTimeout(() => { | ||
[].forEach.call(document.querySelectorAll(classList), function(el) { | ||
el.addEventListener("blur", function(e) { | ||
console.log(1111); | ||
if (isIOS) { | ||
blurAdjust(); | ||
} | ||
}); | ||
}); | ||
}, 1000); | ||
|
||
// 解决苹果不回弹页面 https://blog.csdn.net/m0_37520980/article/details/86305488 | ||
function blurAdjust(e) { | ||
setTimeout(() => { | ||
if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') { | ||
return; | ||
} | ||
let result = 'pc'; | ||
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { // 判断iPhone|iPad|iPod|iOS | ||
result = 'ios'; | ||
} else if (/(Android)/i.test(navigator.userAgent)) { // 判断Android | ||
result = 'android'; | ||
} | ||
|
||
if (result === 'ios') { | ||
document.activeElement.scrollIntoViewIfNeeded(true); | ||
} | ||
}, 100); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters