Commit c277405f authored by Hello's avatar Hello

content

parent 63c1508e
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
data () { data () {
return { return {
fontSize: Number(window.document.documentElement.style.fontSize.replace('px', '')), fontSize: Number(window.document.documentElement.style.fontSize.replace('px', '')),
winHeight: Number(window.localStorage.getItem('height')) || window.innerHeight, winHeight: Number(window.localStorage.getItem('height')) || window.innerHeight,
winWidth: window.innerWidth, winWidth: window.innerWidth,
height: 0, height: 0,
startY: 0, startY: 0,
...@@ -91,14 +91,13 @@ export default { ...@@ -91,14 +91,13 @@ export default {
if (elHeight && part.test(elHeight)) { if (elHeight && part.test(elHeight)) {
headerHeight += Number(elHeight.replace('px', '')) headerHeight += Number(elHeight.replace('px', ''))
} }
if ($el._prevClass && $el._prevClass.indexOf('h-header') === 0) { let paddingTopHeight = window.getComputedStyle($el).paddingTop
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) { let paddingBottomHeight = window.getComputedStyle($el).paddingBottom
headerHeight += 0.8 * vm.fontSize if (paddingTopHeight && part.test(paddingTopHeight)) {
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) { headerHeight += Number(paddingTopHeight.replace('px', ''))
headerHeight += 0.8 * vm.fontSize }
} else if (detectOS() === 'ios') { if (paddingBottomHeight && part.test(paddingBottomHeight)) {
headerHeight += 0.4 * vm.fontSize headerHeight += Number(paddingBottomHeight.replace('px', ''))
}
} }
$el = $el.previousElementSibling $el = $el.previousElementSibling
} }
...@@ -108,7 +107,7 @@ export default { ...@@ -108,7 +107,7 @@ export default {
}, },
getNextElementHeight () { getNextElementHeight () {
let vm = this let vm = this
let nextElement = this.$el.nextElementSibling let nextElement = vm.$el.nextElementSibling
let nextHeight = 0 let nextHeight = 0
do { do {
if (nextElement) { if (nextElement) {
...@@ -117,30 +116,28 @@ export default { ...@@ -117,30 +116,28 @@ export default {
if (elHeight && part.test(elHeight)) { 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) { let paddingTopHeight = window.getComputedStyle(nextElement).paddingTop
let height = nextElement.clientHeight let paddingBottomHeight = window.getComputedStyle(nextElement).paddingBottom
if (detectOS() === 'ios' && height > Math.ceil(vm.fontSize * 0.88)) { if (paddingTopHeight && part.test(paddingTopHeight)) {
nextHeight += 0 nextHeight += Number(paddingTopHeight.replace('px', ''))
} else { }
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) { if (paddingBottomHeight && part.test(paddingBottomHeight)) {
nextHeight += vm.fontSize * 0.68 nextHeight += Number(paddingBottomHeight.replace('px', ''))
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
nextHeight += vm.fontSize * 0.68
}
}
} }
nextElement = nextElement.nextElementSibling
} }
nextElement = nextElement.nextElementSibling
} while (nextElement) } while (nextElement)
return nextHeight return nextHeight
}, },
contentHeight () { contentHeight () {
let vm = this let vm = this
const headerHeight = vm.getHeaderHeight() vm.$nextTick(() => {
const nextHeight = vm.getNextElementHeight() const headerHeight = vm.getHeaderHeight()
let content = vm.$el const nextHeight = vm.getNextElementHeight()
vm.height = (vm.winHeight - nextHeight - headerHeight) let content = vm.$el
content.style.height = (vm.winHeight - nextHeight - headerHeight) + 'px' vm.height = (vm.winHeight - nextHeight - headerHeight)
content.style.height = (vm.winHeight - nextHeight - headerHeight) + 'px'
})
}, },
getKeyBoardHeight () { getKeyBoardHeight () {
let innerWidth = window.innerWidth let innerWidth = window.innerWidth
......
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