Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
TaoHuang
6 years ago
Commit
73578391762303cad29d0f55bdc604ceb9a80eb4
1 parent
9f929e4d
fix input
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
apps/index.html
apps/pages/single/order/ufo/components/modal-price.vue
apps/index.html
View file @
7357839
...
...
@@ -88,6 +88,31 @@
s
.
parentNode
.
insertBefore
(
hm
,
s
);
})();
}());
function
isWeiXinAndIos
()
{
// window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型
let
ua
=
''
+
window
.
navigator
.
userAgent
.
toLowerCase
()
// 通过正则表达式匹配ua中是否含有MicroMessenger字符串且是IOS系统
let
isIos
=
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/i
.
test
(
ua
)
// 是IOS系统
return
isIos
}
(
function
()
{
let
myFunction
let
isWXAndIos
=
isWeiXinAndIos
()
if
(
isWXAndIos
)
{
// 既是微信浏览器 又是ios============(因为查到只有在微信环境下,ios手机上才会出现input失去焦点的时候页面被顶起)
document
.
body
.
addEventListener
(
'focusin'
,
()
=>
{
// 软键盘弹起事件
clearTimeout
(
myFunction
);
});
document
.
body
.
addEventListener
(
'focusout'
,
()
=>
{
// 软键盘关闭事件
clearTimeout
(
myFunction
)
myFunction
=
setTimeout
(
function
()
{
window
.
scrollTo
({
top
:
0
,
left
:
0
,
behavior
:
'smooth'
})
// 重点 =======当键盘收起的时候让页面回到原始位置
},
200
);
});
}
})();
</script>
</body>
</html>
...
...
apps/pages/single/order/ufo/components/modal-price.vue
View file @
7357839
...
...
@@ -55,7 +55,6 @@ export default {
},
mounted() {
this.inputChange = debounce(this.onChange.bind(this), 500);
this.init();
},
watch: {
chgPrice(newVal) {
...
...
@@ -182,23 +181,6 @@ export default {
locfun: 'click:changePrice:no'
});
},
init() {
let myFunction;
if (this.$yoho.isiOS) { // 是ios============(因为查到只有在微信环境下,ios手机上才会出现input失去焦点的时候页面被顶起)
document.body.addEventListener('focusin', () => { // 软键盘弹起事件
clearTimeout(myFunction);
});
document.body.addEventListener('focusout', () => { // 软键盘关闭事件
clearTimeout(myFunction);
myFunction = setTimeout(function() {
window.scrollTo({top: 0, left: 0, behavior: 'smooth'})// 重点 =======当键盘收起的时候让页面回到原始位置
}, 200);
})
}
},
},
components: {Modal, InputUfo}
};
...
...
Please
register
or
login
to post a comment