Skip to content

Commit

Permalink
fix(long_page): long page height not work; !#zh: 长页面高度未生效
Browse files Browse the repository at this point in the history
  • Loading branch information
ly525 committed Aug 25, 2020
1 parent f40cbae commit 7163795
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions front-end/h5/src/engine-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,10 @@ const Engine = {
)
},
renderPreview (pageElements) {
let pageWrapperStyle = {
height: '100%',
position: 'relative'
}
const pageWrapperStyle = this.isLongPage ? {
height: window.__work.height + 'px'

if (this.isLongPage) {
pageWrapperStyle = {
...pageWrapperStyle,
'overflow-y': 'scroll'
}
}
} : {}

const elements = pageElements.map(element => new Element(element))
return (
Expand All @@ -84,13 +77,26 @@ const Engine = {
}
</div>
)
},
getContainerStyle(work) {
const containerStyle = {
position: 'relative',
height: '100%',
}

if (this.isLongPage) {
containerStyle['overflow-y'] = 'scroll'
}
return containerStyle
}
},
render (h) {
const work = window.__work
return <div id="work-container" data-work-id={work.id}>
const containerStyle = this.getContainerStyle(work)

return <div id="work-container" data-work-id={work.id} style={containerStyle}>
{
this.isLongPage ? this.renderLongPage() : this.renderSwiperPage()
this.isLongPage ? this.renderLongPage() : this.renderSwiperPage()
}
</div>
}
Expand Down

0 comments on commit 7163795

Please sign in to comment.