add
This commit is contained in:
parent
6b3ce21739
commit
f9e628043d
|
@ -22,7 +22,12 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "购物",
|
||||
"disableScroll": true,
|
||||
"navigationStyle": "custom"
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom",
|
||||
"app-plus": {
|
||||
// 将回弹属性关掉
|
||||
"bounce": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -95,8 +95,10 @@
|
|||
</scroll-view>
|
||||
</view>
|
||||
</viewPopup>
|
||||
<scroll-view class="list" scroll-y @scrolltolower="loadMoreGood" @scroll='hideHeadView'>
|
||||
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id" @click="openGoodPopup(item)">
|
||||
<scroll-view class="list" id='drag_area' style="overscroll-behavior: none;" @scroll="hideHeadView"
|
||||
scroll-y @scrolltolower="loadMoreGood">
|
||||
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id"
|
||||
@click="openGoodPopup(item)">
|
||||
<view class="shop-img">
|
||||
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
|
||||
</view>
|
||||
|
@ -152,7 +154,8 @@
|
|||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
ref,
|
||||
onMounted
|
||||
} from "vue"
|
||||
import {
|
||||
goodListApi,
|
||||
|
@ -166,13 +169,21 @@
|
|||
import viewPopup from "@/components/viewPopup.vue"
|
||||
import goodPopup from "@/components/goodPopup.vue"
|
||||
import useCartStore from "@/store/cart.js"
|
||||
import {
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
|
||||
/*商品列表滚动隐藏头部导航 */
|
||||
const instance = getCurrentInstance(); // 获取组件实例
|
||||
const targetHeight = ref(0)
|
||||
const isScroll = ref(false)
|
||||
let lastScollTop = 0
|
||||
const hideHeadView = (e) => {
|
||||
if (e.detail.scrollTop <= 0 || e.detail.scrollTop >= targetHeight.value) return
|
||||
num.value = e.detail.scrollTop
|
||||
isScroll.value = e.detail.scrollTop > lastScollTop
|
||||
lastScollTop = e.detail.scrollTop
|
||||
|
||||
}
|
||||
/*商品列表滚动隐藏头部导航结束 */
|
||||
const test = () => {
|
||||
|
@ -182,9 +193,7 @@
|
|||
}
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const show = ref(0);
|
||||
|
||||
const topActive = ref(0);
|
||||
const changeOne = (item, index) => {
|
||||
console.log('选择', item, index);
|
||||
|
@ -363,10 +372,33 @@
|
|||
onLoad(() => {
|
||||
getgoodClassList();
|
||||
getGoodList();
|
||||
|
||||
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
getCartList();
|
||||
})
|
||||
onMounted(() => {
|
||||
const instance = getCurrentInstance(); // 获取组件实例
|
||||
const getWXDom = () => {
|
||||
let query = uni.createSelectorQuery().in(instance).select("#drag_area");
|
||||
query
|
||||
.fields({
|
||||
size: true,
|
||||
scrollOffset: true,
|
||||
},
|
||||
(data) => {
|
||||
targetHeight.value = data.scrollHeight - data.height
|
||||
}
|
||||
)
|
||||
.exec();
|
||||
}
|
||||
setTimeout(() => {
|
||||
getWXDom()
|
||||
}, 100)
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
Loading…
Reference in New Issue