Commit 2526baac authored by 24776's avatar 24776

content

parents be768efe c9d4ed65
......@@ -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,16 +21,17 @@ export default {
},
data () {
return {
docmHeight: '0', // 默认屏幕高度
showHeight: '0', // 实时屏幕高度
topHeight: '0', // content距离顶部的高度
contentsHeight: '0', // 内容区域本来高度
docmHeight: 0, // 默认屏幕高度
showHeight: 0, // 实时屏幕高度
topHeight: 0, // content距离顶部的高度
contentsHeight: 0, // 内容区域本来高度
isResize: false, // 默认屏幕高度是否已获取
distance: 0,
final: 0,
fontSize: Number(window.document.documentElement.style.fontSize.replace('px', '')),
winHeight: window.innerHeight,
winWidth: window.innerWidth,
contentScrollTop: 0,
}
},
watch: {
......@@ -71,6 +67,29 @@ export default {
// this.$el.style.height = parseInt(this.contentsHeight) + this.distance + 'px'
// this.$el.scrollTop = this.final
})
// document.body.addEventListener('focusout', () => {
// if (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
// }
// 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'
......@@ -187,7 +206,7 @@ export default {
}
return 400
} else {
return 325
return 300
}
},
},
......
......@@ -10,7 +10,10 @@
<tab-item>Vue</tab-item>
<tab-item>APP</tab-item>
</s-tab>
<<<<<<< HEAD
<div style="backgroundColor:red;height:50px"/>
=======
>>>>>>> c9d4ed65258c2013b54bec8dadfe8daca1f98232
<h-content >
<list-item>
<item>
......@@ -97,6 +100,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>
......
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