滑动到顶部
This commit is contained in:
		
							parent
							
								
									87e5515b98
								
							
						
					
					
						commit
						1a3b39f31e
					
				@ -11,7 +11,7 @@
 | 
			
		||||
			</view>
 | 
			
		||||
			<view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">好评</view>
 | 
			
		||||
		</view>
 | 
			
		||||
		<scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore" :scroll-top="top">
 | 
			
		||||
		<scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore" :scroll-top="scrollTop" @scroll="scroll">
 | 
			
		||||
			<view v-for="goods in goodsList" :key="goods.goods_id" class="goods-item" @click="toDetailsPage(goods.goods_id)">
 | 
			
		||||
				<image :src="goods.goods_image"></image>
 | 
			
		||||
				<view class="right">
 | 
			
		||||
@ -39,7 +39,10 @@ export default {
 | 
			
		||||
			loadStatus: 'loadmore',
 | 
			
		||||
			timer: true, // 防止上拉加载短时间内多次调用,
 | 
			
		||||
			value:"",
 | 
			
		||||
			top:0
 | 
			
		||||
			scrollTop: 0,
 | 
			
		||||
            old: {
 | 
			
		||||
                scrollTop: 0
 | 
			
		||||
            }
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
@ -65,6 +68,9 @@ export default {
 | 
			
		||||
		this.ShopSearch()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		scroll: function(e) {
 | 
			
		||||
            this.old.scrollTop = e.detail.scrollTop; // 必要
 | 
			
		||||
        },
 | 
			
		||||
		setNavSearchInput(keyword) {
 | 
			
		||||
			console.log(keyword);
 | 
			
		||||
			// #ifdef APP-PLUS
 | 
			
		||||
@ -133,7 +139,10 @@ export default {
 | 
			
		||||
		switchCurrent(current) {
 | 
			
		||||
			this.page = 1
 | 
			
		||||
			if(current == 1 && this.current == 1) this.priceOrderAsc = !this.priceOrderAsc;
 | 
			
		||||
			this.top=0
 | 
			
		||||
			this.scrollTop = this.old.scrollTop
 | 
			
		||||
            this.$nextTick(function() {
 | 
			
		||||
                this.scrollTop = 0
 | 
			
		||||
            });
 | 
			
		||||
			this.ShopSearch()
 | 
			
		||||
			this.current = current;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user