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
154e58b9
Commit
154e58b9
authored
Sep 25, 2019
by
JingChao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
content
parent
ab1f4ed9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
93 deletions
+0
-93
index.vue
packages/components/HContent/index.vue
+0
-93
No files found.
packages/components/HContent/index.vue
View file @
154e58b9
...
@@ -21,95 +21,15 @@ export default {
...
@@ -21,95 +21,15 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
docmHeight
:
0
,
// 默认屏幕高度
showHeight
:
0
,
// 实时屏幕高度
topHeight
:
0
,
// content距离顶部的高度
contentsHeight
:
0
,
// 内容区域本来高度
isResize
:
false
,
// 默认屏幕高度是否已获取
fontSize
:
Number
(
window
.
document
.
documentElement
.
style
.
fontSize
.
replace
(
'px'
,
''
)),
fontSize
:
Number
(
window
.
document
.
documentElement
.
style
.
fontSize
.
replace
(
'px'
,
''
)),
winHeight
:
window
.
innerHeight
,
winHeight
:
window
.
innerHeight
,
winWidth
:
window
.
innerWidth
,
winWidth
:
window
.
innerWidth
,
contentScrollTop
:
0
,
}
}
},
},
watch
:
{
'showHeight'
:
function
()
{
if
(
$config
.
isMobilePlatform
&&
detectOS
()
===
'android'
)
{
if
(
this
.
docmHeight
>=
this
.
showHeight
)
{
// 软键盘弹出的事件处理
let
activeElement
=
document
.
activeElement
let
offsetTop
=
activeElement
.
offsetTop
let
offsetParent
=
activeElement
.
offsetParent
let
viewTop
=
offsetParent
.
clientHeight
this
.
topHeight
=
this
.
$el
.
offsetTop
if
(
activeElement
===
document
.
body
)
{
return
}
while
(
offsetParent
!==
document
.
body
)
{
offsetTop
+=
offsetParent
.
offsetTop
offsetParent
=
offsetParent
.
offsetParent
}
offsetTop
=
this
.
docmHeight
-
offsetTop
-
viewTop
<
0
?
offsetTop
-
this
.
topHeight
-
viewTop
:
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'
}
}
else
{
// 软键盘收起的事件处理
this
.
$el
.
style
.
height
=
parseInt
(
this
.
contentsHeight
)
+
'px'
this
.
$el
.
style
.
transform
=
'translate(0px, 0px) scale(1) translateZ(0px)'
}
}
},
},
mounted
()
{
mounted
()
{
if
(
this
.
calContent
)
{
if
(
this
.
calContent
)
{
this
.
contentHeight
()
this
.
contentHeight
()
}
}
this
.
contentsHeight
=
this
.
$el
.
style
.
height
.
slice
(
0
,
this
.
$el
.
style
.
height
.
length
-
2
)
if
(
$config
.
isMobilePlatform
&&
detectOS
()
===
'ios'
)
{
document
.
body
.
addEventListener
(
'focusin'
,
()
=>
{
// 软键盘弹出的事件处理
let
keyboardHeight
=
this
.
getKeyBoardHeight
()
let
activeElement
=
document
.
activeElement
let
offsetTop
=
activeElement
.
offsetTop
let
offsetParent
=
activeElement
.
offsetParent
if
(
activeElement
===
document
.
body
)
{
return
}
while
(
offsetParent
!==
document
.
body
)
{
offsetTop
+=
offsetParent
.
offsetTop
offsetParent
=
offsetParent
.
offsetParent
}
debugger
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'
,
()
=>
{
// 软键盘收起的事件处理
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
)
{
// 默认屏幕高度
this
.
docmHeight
=
document
.
documentElement
.
clientHeight
this
.
isResize
=
true
}
// 实时屏幕高度
this
.
showHeight
=
document
.
body
.
clientHeight
})()
}
},
},
methods
:
{
methods
:
{
getHeaderHeight
()
{
getHeaderHeight
()
{
...
@@ -168,19 +88,6 @@ export default {
...
@@ -168,19 +88,6 @@ export default {
let
content
=
vm
.
$el
let
content
=
vm
.
$el
content
.
style
.
height
=
(
window
.
innerHeight
-
nextHeight
-
headerHeight
)
+
'px'
content
.
style
.
height
=
(
window
.
innerHeight
-
nextHeight
-
headerHeight
)
+
'px'
},
},
// 键盘的高度
getKeyBoardHeight
()
{
var
innerWidth
=
window
.
innerWidth
if
(
detectOS
()
===
'ios'
)
{
if
(
innerWidth
>=
375
&&
innerHeight
>=
812
)
{
return
460
}
return
400
}
else
{
return
300
}
},
},
},
}
}
</
script
>
</
script
>
...
...
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