Commit 9c63afc4 authored by 刘用法's avatar 刘用法

首页点击头部滚动到顶部

parent 74762c68
<template>
<view :class="['content', {'fixed': fixed}]">
<u-navbar :is-back="false" :is-fixed="false" :background="{ background: 'transparent' }" :border-bottom="false">
<text class="title-view">{{title}}</text>
</u-navbar>
<view :class="['content', {'fixed': fixed}]">
<view @click="handleClick">
<u-navbar :is-back="false" :is-fixed="false" :background="{ background: 'transparent' }" :border-bottom="false">
<text class="title-view">{{title}}</text>
</u-navbar>
</view>
<slot></slot>
</view>
</template>
......@@ -25,7 +27,9 @@
}
},
methods: {
handleClick() {
this.$emit('click')
}
}
}
</script>
......
<template>
<TabBarPage title="扳手会" :fixed="true">
<TabBarPage title="扳手会" :fixed="true" @click="goTop">
<view class="content-view">
<scroll-view style="height: 100%;" scroll-y @scrolltolower="reachBottom"
<scroll-view style="height: 100%;" scroll-y @scrolltolower="reachBottom" :scroll-top="scrollTop" @scroll="scroll"
scroll-anchoring scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherabort="onAbort" enable-back-to-top>
<!-- <TabBarPage title="扳手会"> -->
<image class="banner-image" :src="bannerImage" @click="handleClickBanner"></image>
......@@ -116,7 +116,11 @@
waitInit: false, // 当token为空时,等待自动登录结束
triggered: false,
_freshing: false,
visible: false,
visible: false,
scrollTop: 0,
old: {
scrollTop: 0
}
};
},
watch: {
......@@ -275,6 +279,15 @@
onRestore() {
this.triggered = 'restore'; // 需要重置
},
scroll(e) {
this.old.scrollTop = e.detail.scrollTop
},
goTop(e) {
this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
});
},
/* 立即入驻 */
immediatelyIn() {
if (this.vuex_token) {
......
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