Commit c9d4ed65 authored by JingChao's avatar JingChao

键盘弹出问题修复

parent 180619c9
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
*/ */
<template> <template>
<div <div class="content">
:class="cusClass" class="content">
<slot/> <slot/>
</div> </div>
</template> </template>
...@@ -15,10 +14,6 @@ import { detectOS } from '../../common/utils/index' ...@@ -15,10 +14,6 @@ import { detectOS } from '../../common/utils/index'
export default { export default {
name: 'HContent', name: 'HContent',
props: { props: {
cusClass: {
type: String,
default: '',
},
calContent: { calContent: {
type: Boolean, type: Boolean,
default: true, default: true,
...@@ -26,14 +21,15 @@ export default { ...@@ -26,14 +21,15 @@ export default {
}, },
data () { data () {
return { return {
docmHeight: '0', // 默认屏幕高度 docmHeight: 0, // 默认屏幕高度
showHeight: '0', // 实时屏幕高度 showHeight: 0, // 实时屏幕高度
topHeight: '0', // content距离顶部的高度 topHeight: 0, // content距离顶部的高度
contentsHeight: '0', // 内容区域本来高度 contentsHeight: 0, // 内容区域本来高度
isResize: false, // 默认屏幕高度是否已获取 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: { watch: {
...@@ -72,10 +68,10 @@ export default { ...@@ -72,10 +68,10 @@ export default {
this.contentHeight() this.contentHeight()
} }
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)
this.topHeight = this.$el.offsetTop + 40
if (detectOS() === 'ios') { if (detectOS() === 'ios') {
document.body.addEventListener('focusin', () => { document.body.addEventListener('focusin', () => {
// 软键盘弹出的事件处理 // 软键盘弹出的事件处理
let keyboardHeight = this.getKeyBoardHeight() let keyboardHeight = this.getKeyBoardHeight()
let activeElement = document.activeElement let activeElement = document.activeElement
let offsetTop = activeElement.offsetTop let offsetTop = activeElement.offsetTop
...@@ -179,7 +175,7 @@ export default { ...@@ -179,7 +175,7 @@ export default {
} }
return 400 return 400
} else { } else {
return 275 return 300
} }
}, },
}, },
......
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
<tab-item>Vue</tab-item> <tab-item>Vue</tab-item>
<tab-item>APP</tab-item> <tab-item>APP</tab-item>
</s-tab> </s-tab>
<s-tab>
<tab-item>Vue</tab-item>
<tab-item>APP</tab-item>
</s-tab>
<h-content > <h-content >
<list-item> <list-item>
<item> <item>
...@@ -56,6 +52,22 @@ ...@@ -56,6 +52,22 @@
<section slot="name">tun</section> <section slot="name">tun</section>
<input slot="content" type="text"> <input slot="content" type="text">
</item> </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> </list-item>
</h-content> </h-content>
<!-- <s-tab> <!-- <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