12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- module.exports = {
- data() {
- return {
-
- contentContainerTop: '0px',
- contentContainerIsTop: false,
-
-
- sectionContainerTop: '0px'
- }
- },
- onReady() {
- this.updateSectionContainerTop()
- },
- methods: {
-
- async _handleContentConatinerPosition() {
-
- const contentContainer = await this._tGetRect('#content_container')
-
- this._tGetRect('#section_container').then((res) => {
-
-
- if (res.top - contentContainer.bottom != 15) {
- const newTop = res.top - (contentContainer.height + uni.upx2px(20))
- const minTop = this.vuex_custom_bar_height + 1
- if (newTop < minTop) {
- this.contentContainerTop = minTop + 'px'
- this.contentContainerIsTop = true
- } else {
- this.contentContainerTop = newTop + 'px'
- this.contentContainerIsTop = false
- }
- }
- })
- },
-
- updateSectionContainerTop() {
- this._tGetRect('#content_container').then((res) => {
- this.contentContainerTop = (this.vuex_custom_bar_height + 148) + 'px'
- this.sectionContainerTop = (res.height + 20) + 'px'
- })
- }
- },
-
- onPageScroll() {
- this._handleContentConatinerPosition()
- }
- }
|