Commit ea9b1d9f authored by JingChao's avatar JingChao

content

parent 6c8da39d
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
} }
this.contentsHeight = this.$el.style.height.slice(0, this.$el.style.height.length - 2) this.contentsHeight = this.$el.style.height.slice(0, this.$el.style.height.length - 2)
if ($config.isMobilePlatform && detectOS() === 'ios') { if ($config.isMobilePlatform && detectOS() === 'ios') {
document.body.addEventListener('focusin', () => { document.body.addEventListener('focusin', (e) => {
// 软键盘弹出的事件处理 // 软键盘弹出的事件处理
let keyboardHeight = this.getKeyBoardHeight() let keyboardHeight = this.getKeyBoardHeight()
...@@ -83,6 +83,7 @@ export default { ...@@ -83,6 +83,7 @@ export default {
offsetTop += offsetParent.offsetTop offsetTop += offsetParent.offsetTop
offsetParent = offsetParent.offsetParent offsetParent = offsetParent.offsetParent
} }
debugger
offsetTop = (innerHeight - offsetTop) < keyboardHeight ? (keyboardHeight - (innerHeight - offsetTop)) : 0 offsetTop = (innerHeight - offsetTop) < keyboardHeight ? (keyboardHeight - (innerHeight - offsetTop)) : 0
if (offsetTop > 0) { if (offsetTop > 0) {
this.$el.style.transition = 'all .2s cubic-bezier(0.165, 0.84, 0.44, 1) 0s' this.$el.style.transition = 'all .2s cubic-bezier(0.165, 0.84, 0.44, 1) 0s'
...@@ -118,7 +119,8 @@ export default { ...@@ -118,7 +119,8 @@ export default {
do { do {
if ($el) { if ($el) {
let elHeight = window.getComputedStyle($el).height let elHeight = window.getComputedStyle($el).height
if (elHeight) { let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) {
headerHeight += Number(elHeight.replace('px', '')) headerHeight += Number(elHeight.replace('px', ''))
} }
if ($el._prevClass && $el._prevClass.indexOf('h-header') === 0) { if ($el._prevClass && $el._prevClass.indexOf('h-header') === 0) {
...@@ -143,7 +145,8 @@ export default { ...@@ -143,7 +145,8 @@ export default {
do { do {
if (nextElement) { if (nextElement) {
let elHeight = window.getComputedStyle(nextElement).height let elHeight = window.getComputedStyle(nextElement).height
if (elHeight) { let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) {
nextHeight += Number(elHeight.replace('px', '')) nextHeight += Number(elHeight.replace('px', ''))
} }
if (nextElement._prevClass && nextElement._prevClass.indexOf('h-bottom-tab') === 0) { if (nextElement._prevClass && nextElement._prevClass.indexOf('h-bottom-tab') === 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment