Commit c9d4ed65 authored by JingChao's avatar JingChao

键盘弹出问题修复

parent 180619c9
......@@ -4,8 +4,7 @@
*/
<template>
<div
:class="cusClass" class="content">
<div class="content">
<slot/>
</div>
</template>
......@@ -15,10 +14,6 @@ import { detectOS } from '../../common/utils/index'
export default {
name: 'HContent',
props: {
cusClass: {
type: String,
default: '',
},
calContent: {
type: Boolean,
default: true,
......@@ -26,14 +21,15 @@ export default {
},
data () {
return {
docmHeight: '0', // 默认屏幕高度
showHeight: '0', // 实时屏幕高度
topHeight: '0', // content距离顶部的高度
contentsHeight: '0', // 内容区域本来高度
docmHeight: 0, // 默认屏幕高度
showHeight: 0, // 实时屏幕高度
topHeight: 0, // content距离顶部的高度
contentsHeight: 0, // 内容区域本来高度
isResize: false, // 默认屏幕高度是否已获取
fontSize: Number(window.document.documentElement.style.fontSize.replace('px', '')),
winHeight: window.innerHeight,
winWidth: window.innerWidth,
contentScrollTop: 0,
}
},
watch: {
......@@ -72,10 +68,10 @@ export default {
this.contentHeight()
}
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 activeElement = document.activeElement
let offsetTop = activeElement.offsetTop
......@@ -179,7 +175,7 @@ export default {
}
return 400
} else {
return 275
return 300
}
},
},
......
......@@ -10,10 +10,6 @@
<tab-item>Vue</tab-item>
<tab-item>APP</tab-item>
</s-tab>
<s-tab>
<tab-item>Vue</tab-item>
<tab-item>APP</tab-item>
</s-tab>
<h-content >
<list-item>
<item>
......@@ -56,6 +52,22 @@
<section slot="name">tun</section>
<input slot="content" type="text">
</item>
<item>
<section slot="name">tun</section>
<input slot="content" type="text">
</item>
<item>
<section slot="name">tun</section>
<input slot="content" type="text">
</item>
<item>
<section slot="name">tun</section>
<input slot="content" type="text">
</item>
<item>
<section slot="name">tun</section>
<input slot="content" type="text">
</item>
</list-item>
</h-content>
<!-- <s-tab>
......
File deleted
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