Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-easy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
easyUI
hls-easy-ui
Commits
180619c9
Commit
180619c9
authored
Sep 18, 2019
by
24776
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
软件盘遮挡问题
parent
2299bea9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
66 deletions
+42
-66
index.js
config/index.js
+1
-1
index.vue
packages/components/HContent/index.vue
+40
-65
main.js
src/main.js
+1
-0
www.zip
www.zip
+0
-0
No files found.
config/index.js
View file @
180619c9
...
...
@@ -23,7 +23,7 @@ module.exports = {
proxyTable
:
{},
// Various Dev Server settings
host
:
'
192.168.137.1
'
,
// can be overwritten by process.env.HOST
host
:
'
localhost
'
,
// can be overwritten by process.env.HOST
port
:
8080
,
// can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser
:
false
,
errorOverlay
:
true
,
...
...
packages/components/HContent/index.vue
View file @
180619c9
...
...
@@ -5,8 +5,7 @@
<
template
>
<div
:class=
"cusClass"
class=
"content"
@
touchstart=
"start"
@
touchend=
"end"
>
:class=
"cusClass"
class=
"content"
>
<slot/>
</div>
</
template
>
...
...
@@ -27,11 +26,9 @@ export default {
},
data
()
{
return
{
content
:
'content'
,
docmHeight
:
'0'
,
// 默认屏幕高度
showHeight
:
'0'
,
// 实时屏幕高度
topHeight
:
'0'
,
// content距离顶部的高度
transHeight
:
'0'
,
// content移动的距离
contentsHeight
:
'0'
,
// 内容区域本来高度
isResize
:
false
,
// 默认屏幕高度是否已获取
fontSize
:
Number
(
window
.
document
.
documentElement
.
style
.
fontSize
.
replace
(
'px'
,
''
)),
...
...
@@ -41,13 +38,14 @@ export default {
},
watch
:
{
'showHeight'
:
function
()
{
if
(
detectOS
()
!==
'ios'
)
{
if
(
this
.
docmHeight
>=
this
.
showHeight
)
{
// 软键盘弹出的事件处理
let
activeElement
=
document
.
activeElement
let
offsetTop
=
activeElement
.
offsetTop
let
offsetParent
=
activeElement
.
offsetParent
let
viewTop
=
offsetParent
.
clientHeight
this
.
topHeight
=
document
.
getElementsByClassName
(
this
.
content
)[
0
]
.
offsetTop
this
.
topHeight
=
this
.
$el
.
offsetTop
if
(
activeElement
===
document
.
body
)
{
return
}
...
...
@@ -55,17 +53,17 @@ export default {
offsetTop
+=
offsetParent
.
offsetTop
offsetParent
=
offsetParent
.
offsetParent
}
let
pointY
=
offsetTop
offsetTop
=
this
.
docmHeight
-
pointY
-
viewTop
<
0
?
offsetTop
-
this
.
topHeight
-
viewTop
:
0
// alert(offsetTop)
offsetTop
=
this
.
docmHeight
-
offsetTop
-
viewTop
<
0
?
offsetTop
-
this
.
topHeight
-
viewTop
:
0
if
(
offsetTop
>
0
)
{
document
.
getElementsByClassName
(
this
.
content
)[
0
]
.
style
.
transition
=
'all .2s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
document
.
getElementsByClassName
(
this
.
content
)[
0
]
.
style
.
transform
=
'translate(0px, -'
+
offsetTop
+
'px) scale(1) translateZ(0px)'
document
.
getElementsByClassName
(
this
.
content
)[
0
]
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
offsetTop
+
'px'
this
.
$el
.
style
.
transition
=
'all .2s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
this
.
$el
.
style
.
transform
=
'translate(0px, -'
+
offsetTop
+
'px) scale(1) translateZ(0px)'
this
.
$el
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
offsetTop
+
'px'
}
}
else
{
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
'px'
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
transform
=
'translate(0px, 0px) scale(1) translateZ(0px)'
// 软键盘收起的事件处理
this
.
$el
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
'px'
this
.
$el
.
style
.
transform
=
'translate(0px, 0px) scale(1) translateZ(0px)'
}
}
},
},
...
...
@@ -73,16 +71,12 @@ export default {
if
(
this
.
calContent
)
{
this
.
contentHeight
()
}
console
.
log
(
document
.
getElementsByClassName
(
this
.
content
)[
0
].
offsetHeight
)
this
.
contentsHeight
=
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
height
.
slice
(
0
,
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
height
.
length
-
2
)
this
.
topHeight
=
document
.
getElementsByClassName
(
this
.
content
)[
0
].
offsetTop
+
40
console
.
log
(
this
.
topHeight
)
if
(
this
.
detect
()
===
'ios'
)
{
// focusin和focusout支持冒泡,对应focus和blur, 使用focusin和focusout的原因是focusin和focusout可以冒泡,focus和blur不会冒泡,这样就可以使用事件代理,处理多个输入框存在的情况。
this
.
contentsHeight
=
this
.
$el
.
style
.
height
.
slice
(
0
,
this
.
$el
.
style
.
height
.
length
-
2
)
this
.
topHeight
=
this
.
$el
.
offsetTop
+
40
if
(
detectOS
()
===
'ios'
)
{
document
.
body
.
addEventListener
(
'focusin'
,
()
=>
{
let
keyboardHeight
=
this
.
getKeyBoardHeight
()
// 软键盘弹出的事件处理
let
keyboardHeight
=
this
.
getKeyBoardHeight
()
let
activeElement
=
document
.
activeElement
let
offsetTop
=
activeElement
.
offsetTop
let
offsetParent
=
activeElement
.
offsetParent
...
...
@@ -93,21 +87,21 @@ export default {
offsetTop
+=
offsetParent
.
offsetTop
offsetParent
=
offsetParent
.
offsetParent
}
let
pointY
=
offsetTop
this
.
transHeight
=
(
innerHeight
-
pointY
)
<
keyboardHeight
?
(
keyboardHeight
-
(
innerHeight
-
pointY
))
:
0
console
.
log
(
this
.
transHeight
)
if
(
this
.
transHeight
>
0
)
{
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
transition
=
'all .2s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
transform
=
'translate(0px, -'
+
this
.
transHeight
+
'px) scale(1) translateZ(0px)'
document
.
getElementsByClassName
(
this
.
content
)[
0
].
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
this
.
transHeight
+
'px'
offsetTop
=
(
innerHeight
-
offsetTop
)
<
keyboardHeight
?
(
keyboardHeight
-
(
innerHeight
-
offsetTop
))
:
0
if
(
offsetTop
>
0
)
{
this
.
$el
.
style
.
transition
=
'all .2s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
this
.
$el
.
style
.
transform
=
'translate(0px, -'
+
offsetTop
+
'px) scale(1) translateZ(0px)'
this
.
$el
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
offsetTop
+
'px'
}
})
document
.
body
.
addEventListener
(
'focusout'
,
()
=>
{
// 软键盘收起的事件处理
document
.
getElementsByClassName
(
this
.
content
)[
0
]
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
'px'
document
.
getElementsByClassName
(
this
.
content
)[
0
]
.
style
.
transform
=
'translate(0px, 0px) scale(1) translateZ(0px)'
this
.
$el
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
'px'
this
.
$el
.
style
.
transform
=
'translate(0px, 0px) scale(1) translateZ(0px)'
})
}
// 当视图窗口大小发生改变时
window
.
onresize
=
()
=>
{
return
(()
=>
{
if
(
!
this
.
isResize
)
{
...
...
@@ -175,30 +169,11 @@ export default {
let
content
=
vm
.
$el
content
.
style
.
height
=
(
window
.
innerHeight
-
nextHeight
-
headerHeight
)
+
'px'
},
start
(
event
)
{
},
end
(
event
)
{
// debugger
},
// 判断是android或者ios系统
detect
()
{
let
equipmentType
=
''
let
agent
=
navigator
.
userAgent
.
toLowerCase
()
let
android
=
agent
.
indexOf
(
'android'
)
let
iphone
=
agent
.
indexOf
(
'iphone'
)
let
ipad
=
agent
.
indexOf
(
'ipad'
)
if
(
android
!==
-
1
)
{
equipmentType
=
'android'
}
if
(
iphone
!==
-
1
||
ipad
!==
-
1
)
{
equipmentType
=
'ios'
}
return
equipmentType
},
// 键盘的高度
getKeyBoardHeight
()
{
var
innerWidth
=
window
.
innerWidth
if
(
this
.
detect
()
===
'ios'
)
{
if
(
detectOS
()
===
'ios'
)
{
if
(
innerWidth
>=
375
&&
innerHeight
>=
812
)
{
return
460
}
...
...
src/main.js
View file @
180619c9
...
...
@@ -95,6 +95,7 @@ Vue.config.productionTip = false
vum
.
$vumPlatform
.
ready
(
function
()
{
if
((
vum
.
Platform
.
isAndroid
())
||
(
vum
.
Platform
.
isIOS
()))
{
cordova
.
plugins
.
Keyboard
.
disableScroll
(
true
)
}
})
...
...
www.zip
0 → 100644
View file @
180619c9
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment