scrollview定位
This commit is contained in:
parent
50409cd8c4
commit
011fcbc2e4
@ -27,11 +27,11 @@
|
|||||||
|
|
||||||
<!-- 商品大分类 -->
|
<!-- 商品大分类 -->
|
||||||
<view class="category">
|
<view class="category">
|
||||||
<scroll-view scroll-x="true">
|
<scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
|
||||||
<view class="category-wrap">
|
<view class="category-wrap">
|
||||||
<block v-for="(item,index) in store_category" :key="index">
|
<block v-for="(item,index) in store_category" :key="index">
|
||||||
<view class="category-item" :class="{'category-item-active': index==cate_change}"
|
<view class="category-item" :id="'scroll' + index"
|
||||||
@click="changeCate(index)">
|
:class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
|
||||||
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
|
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
|
||||||
shape="circle">
|
shape="circle">
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
@ -80,7 +80,8 @@
|
|||||||
<view class="popup-wrap-category">
|
<view class="popup-wrap-category">
|
||||||
<view class="popup-wrap-category-wrap">
|
<view class="popup-wrap-category-wrap">
|
||||||
<block v-for="(item,index) in store_category" :key="index">
|
<block v-for="(item,index) in store_category" :key="index">
|
||||||
<view class="popup-wrap-category-item" :class="{'category-item-active': index==cate_change}"
|
<view class="popup-wrap-category-item"
|
||||||
|
:class="{'popup-wrap-category-item-active': index==cate_change}"
|
||||||
@click="changeCate(index)">
|
@click="changeCate(index)">
|
||||||
<u--image class="popup-wrap-category-item-img" width="108rpx" :src="item.pic"
|
<u--image class="popup-wrap-category-item-img" width="108rpx" :src="item.pic"
|
||||||
height="108rpx" shape="circle">
|
height="108rpx" shape="circle">
|
||||||
@ -130,7 +131,8 @@
|
|||||||
rand: 1
|
rand: 1
|
||||||
},
|
},
|
||||||
wrapHeight: 300,
|
wrapHeight: 300,
|
||||||
touchstarty: 0
|
touchstarty: 0,
|
||||||
|
scrollIndex: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
@ -205,6 +207,9 @@
|
|||||||
if (this.where.cate_pid) this.wrapHeight = 360;
|
if (this.where.cate_pid) this.wrapHeight = 360;
|
||||||
else this.wrapHeight = 300;
|
else this.wrapHeight = 300;
|
||||||
|
|
||||||
|
// scrollView 滚动到对应选择的分类
|
||||||
|
this.scrollIndex = 'scroll' + e;
|
||||||
|
|
||||||
this.$refs.popup && this.$refs.popup.close();
|
this.$refs.popup && this.$refs.popup.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@
|
|||||||
|
|
||||||
<!-- 商品大分类 -->
|
<!-- 商品大分类 -->
|
||||||
<view class="category">
|
<view class="category">
|
||||||
<scroll-view scroll-x="true">
|
<scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
|
||||||
<view class="category-wrap">
|
<view class="category-wrap">
|
||||||
<block v-for="(item,index) in store_category" :key="index">
|
<block v-for="(item,index) in store_category" :key="index">
|
||||||
<view class="category-item" :class="{'category-item-active': index==cate_change}"
|
<view class="category-item" :id="'scroll' + index"
|
||||||
@click="changeCate(index)">
|
:class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
|
||||||
<u--image class="category-item-img" width="108rpx" :src="item.background"
|
<u--image class="category-item-img" width="108rpx" :src="item.background"
|
||||||
height="108rpx" shape="circle">
|
height="108rpx" shape="circle">
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
@ -192,6 +192,7 @@
|
|||||||
},
|
},
|
||||||
wrapHeight: 300,
|
wrapHeight: 300,
|
||||||
touchstarty: 0,
|
touchstarty: 0,
|
||||||
|
scrollIndex: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -280,6 +281,9 @@
|
|||||||
this.where.merchant_category_id = this.store_category[e].merchant_category_id;
|
this.where.merchant_category_id = this.store_category[e].merchant_category_id;
|
||||||
this.storeMerchantList(true);
|
this.storeMerchantList(true);
|
||||||
|
|
||||||
|
// scrollView 滚动到对应选择的分类
|
||||||
|
this.scrollIndex = 'scroll' + e;
|
||||||
|
|
||||||
this.$refs.popup && this.$refs.popup.close();
|
this.$refs.popup && this.$refs.popup.close();
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
@ -26,11 +26,11 @@
|
|||||||
|
|
||||||
<!-- 商品大分类 -->
|
<!-- 商品大分类 -->
|
||||||
<view class="category">
|
<view class="category">
|
||||||
<scroll-view scroll-x="true">
|
<scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
|
||||||
<view class="category-wrap">
|
<view class="category-wrap">
|
||||||
<block v-for="(item,index) in store_category" :key="index">
|
<block v-for="(item,index) in store_category" :key="index">
|
||||||
<view class="category-item" :class="{'category-item-active': index==cate_change}"
|
<view class="category-item" :id="'scroll' + index"
|
||||||
@click="changeCate(index)">
|
:class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
|
||||||
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
|
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
|
||||||
shape="circle">
|
shape="circle">
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
@ -129,7 +129,8 @@
|
|||||||
sale_type: 1, //1-零售, 2-批发
|
sale_type: 1, //1-零售, 2-批发
|
||||||
},
|
},
|
||||||
wrapHeight: 300,
|
wrapHeight: 300,
|
||||||
touchstarty: 0
|
touchstarty: 0,
|
||||||
|
scrollIndex: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -206,6 +207,9 @@
|
|||||||
this.where.cate_pid = this.store_category[e].store_category_id;
|
this.where.cate_pid = this.store_category[e].store_category_id;
|
||||||
this.getProductslist(true);
|
this.getProductslist(true);
|
||||||
|
|
||||||
|
// scrollView 滚动到对应选择的分类
|
||||||
|
this.scrollIndex = 'scroll' + e;
|
||||||
|
|
||||||
this.$refs.popup && this.$refs.popup.close();
|
this.$refs.popup && this.$refs.popup.close();
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
|
|
||||||
<!-- 商品大分类 -->
|
<!-- 商品大分类 -->
|
||||||
<view class="category">
|
<view class="category">
|
||||||
<scroll-view scroll-x="true">
|
<scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
|
||||||
<view class="category-wrap">
|
<view class="category-wrap">
|
||||||
<block v-for="(item,index) in store_category" :key="index">
|
<block v-for="(item,index) in store_category" :key="index">
|
||||||
<view class="category-item" :class="{'category-item-active': index==cate_change}"
|
<view class="category-item" :id="'scroll' + index"
|
||||||
@click="changeCate(index)">
|
:class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
|
||||||
<block v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
|
<block v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
|
||||||
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
|
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
|
||||||
shape="circle">
|
shape="circle">
|
||||||
@ -315,7 +315,8 @@
|
|||||||
smallTypeDomInfo: null,
|
smallTypeDomInfo: null,
|
||||||
categoryWrapHeight: 0,
|
categoryWrapHeight: 0,
|
||||||
wrapHeight: 360,
|
wrapHeight: 360,
|
||||||
touchstarty: 0
|
touchstarty: 0,
|
||||||
|
scrollIndex: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -527,6 +528,9 @@
|
|||||||
|
|
||||||
this.getHeight();
|
this.getHeight();
|
||||||
|
|
||||||
|
// scrollView 滚动到对应选择的分类
|
||||||
|
this.scrollIndex = 'scroll' + e;
|
||||||
|
|
||||||
// 关闭popup
|
// 关闭popup
|
||||||
this.$refs.popup && this.$refs.popup.close();
|
this.$refs.popup && this.$refs.popup.close();
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user