Fix(首页):[#1544]首页做一个回到顶部的按钮,点击后页面往上回弹到首页顶部
This commit is contained in:
+19
-1
@@ -232,6 +232,14 @@
|
||||
|
||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose">
|
||||
</Coupon-window>
|
||||
<u-back-top :scroll-top="scrollTop">
|
||||
<image
|
||||
:src="webUrl+'/icon/setTop.png'"
|
||||
mode="scaleToFill"
|
||||
style="width: 40px;height: 40px;"
|
||||
@click="setTopHandle"
|
||||
/>
|
||||
</u-back-top>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -380,7 +388,8 @@ export default {
|
||||
contentFestival: {},
|
||||
countyFamous: {},
|
||||
seasonalFood: {},
|
||||
pageKeyId: Object.freeze('home_index')
|
||||
pageKeyId: Object.freeze('home_index'),
|
||||
scrollTop: 0
|
||||
}
|
||||
},
|
||||
computed: mapGetters(["userInfo", 'isLogin']),
|
||||
@@ -443,6 +452,9 @@ export default {
|
||||
url: '/pkg-video/views/lottery'
|
||||
})
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
let that = this;
|
||||
@@ -719,6 +731,12 @@ export default {
|
||||
query.fields({size: true, scrollOffset: true}, (data) => {
|
||||
console.log(JSON.stringify(data))
|
||||
}).exec()
|
||||
},
|
||||
setTopHandle() {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 200
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user