Commit de223b75 authored by JingChao's avatar JingChao

content高度

parent a9642fdf
...@@ -36,53 +36,58 @@ export default { ...@@ -36,53 +36,58 @@ export default {
} }
}, },
methods: { methods: {
getHeader () { getHeaderHeight () {
let $el = this.$el.previousElementSibling let vm = this
let $el = vm.$el.previousElementSibling
let headerHeight = 0
do { do {
if ($el) { if ($el) {
if ($el._prevClass.indexOf('h-header') !== -1) { let elHeight = window.getComputedStyle($el).height
break if (elHeight) {
headerHeight += Number(elHeight.replace('px', ''))
}
if ($el._prevClass && $el._prevClass.indexOf('h-header') === 0) {
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) {
headerHeight += 0.8 * vm.fontSize
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
headerHeight += 0.8 * vm.fontSize
} else if (detectOS() === 'ios') {
headerHeight += 0.4 * vm.fontSize
}
} }
$el = $el.previousElementSibling $el = $el.previousElementSibling
} }
} while ($el) } while ($el)
return $el return headerHeight
}, },
getNextElementHeight () { getNextElementHeight () {
let vm = this let vm = this
let nextElement = this.$el.nextElementSibling let nextElement = this.$el.nextElementSibling
let nextHeight = 0 let nextHeight = 0
let paddingHeight = 0 do {
if (nextElement) { if (nextElement) {
nextHeight = window.getComputedStyle(nextElement).height let elHeight = window.getComputedStyle(nextElement).height
if (nextHeight) { if (elHeight) {
nextHeight = Number(nextHeight.replace('px', '')) nextHeight += Number(elHeight.replace('px', ''))
} }
if (nextElement._prevClass && nextElement._prevClass.indexOf('h-bottom-tab') === 0) {
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) { if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) {
paddingHeight = vm.fontSize * 0.68 nextHeight += vm.fontSize * 0.68
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) { } else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
paddingHeight = vm.fontSize * 0.68 nextHeight += vm.fontSize * 0.68
} }
} }
return nextHeight + paddingHeight }
nextElement = nextElement.nextElementSibling
} while (nextElement)
return nextHeight
}, },
contentHeight () { contentHeight () {
let vm = this let vm = this
const headerEl = this.$el.previousElementSibling const headerHeight = vm.getHeaderHeight()
const nextHeight = this.getNextElementHeight() const nextHeight = vm.getNextElementHeight()
let headerHeight = 0 let content = vm.$el
if (headerEl) {
headerHeight = vm.fontSize * 0.88
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) {
headerHeight = headerHeight + 0.8 * vm.fontSize
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
headerHeight = headerHeight + 0.8 * vm.fontSize
} else if (detectOS() === 'ios') {
headerHeight = headerHeight + 0.4 * vm.fontSize
}
}
let content = this.$el
content.style.height = (window.innerHeight - nextHeight - headerHeight) + 'px' content.style.height = (window.innerHeight - nextHeight - headerHeight) + 'px'
}, },
}, },
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
</div> </div>
<div slot="center">小易</div> <div slot="center">小易</div>
</h-header> </h-header>
<s-tab>
<tab-item>Vue</tab-item>
<tab-item>APP</tab-item>
</s-tab>
<div style="height: 60px"/>
<h-content id="home-content"> <h-content id="home-content">
<div v-for="item in message" class="message"> <div v-for="item in message" class="message">
<p v-show="false" class="message-time" v-text="item.time"/> <p v-show="false" class="message-time" v-text="item.time"/>
...@@ -22,9 +27,12 @@ ...@@ -22,9 +27,12 @@
</div> </div>
</div> </div>
</h-content> </h-content>
<bottom-tab> <s-tab>
<tab-item>Vue</tab-item>
</bottom-tab> <tab-item>APP</tab-item>
</s-tab>
<div style="height: 40px;"/>
<bottom-tab/>
</h-view> </h-view>
</template> </template>
...@@ -49,7 +57,7 @@ export default { ...@@ -49,7 +57,7 @@ export default {
}, },
mounted () { mounted () {
this.height = this.$refs.textarea.clientHeight // this.height = this.$refs.textarea.clientHeight
}, },
methods: { methods: {
scrollBottom () { scrollBottom () {
......
...@@ -8513,7 +8513,7 @@ vux-blazy@^1.6.4: ...@@ -8513,7 +8513,7 @@ vux-blazy@^1.6.4:
resolved "https://registry.yarnpkg.com/vux-blazy/-/vux-blazy-1.6.4.tgz#e33073d902e0a3844ef1a463cce3ca2e0aab47bf" resolved "https://registry.yarnpkg.com/vux-blazy/-/vux-blazy-1.6.4.tgz#e33073d902e0a3844ef1a463cce3ca2e0aab47bf"
integrity sha1-4zBz2QLgo4RO8aRjzOPKLgqrR78= integrity sha1-4zBz2QLgo4RO8aRjzOPKLgqrR78=
vux-loader@^1.0.56: vux-loader@latest:
version "1.2.9" version "1.2.9"
resolved "https://registry.yarnpkg.com/vux-loader/-/vux-loader-1.2.9.tgz#51de423753332ce102eae1551a28b2b1155142b3" resolved "https://registry.yarnpkg.com/vux-loader/-/vux-loader-1.2.9.tgz#51de423753332ce102eae1551a28b2b1155142b3"
integrity sha512-AjaD08eyeflQgGwAVJjcwA245h2hTJgXR5pRfLajgmIeEXpbzXs41FnuKLig5U2EQpYyMJ7/f/2Rdlr7cYrIOA== integrity sha512-AjaD08eyeflQgGwAVJjcwA245h2hTJgXR5pRfLajgmIeEXpbzXs41FnuKLig5U2EQpYyMJ7/f/2Rdlr7cYrIOA==
......
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