Compare commits

...

2 Commits

Author SHA1 Message Date
zmj 08fbd02dca add 2024-05-07 19:10:08 +08:00
zmj f9e628043d add 2024-05-07 19:02:46 +08:00
2 changed files with 141 additions and 104 deletions

View File

@ -22,7 +22,12 @@
"style": { "style": {
"navigationBarTitleText": "购物", "navigationBarTitleText": "购物",
"disableScroll": true, "disableScroll": true,
"navigationStyle": "custom" "enablePullDownRefresh": false,
"navigationStyle": "custom",
"app-plus": {
//
"bounce": "none"
}
} }
}, },
{ {

View File

@ -95,10 +95,12 @@
</scroll-view> </scroll-view>
</view> </view>
</viewPopup> </viewPopup>
<scroll-view class="list" scroll-y @scrolltolower="loadMoreGood" @scroll='hideHeadView'> <scroll-view class="list" id='drag_area' style="overscroll-behavior: none;" @scroll="hideHeadView"
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id" @click="openGoodPopup(item)"> scroll-y @scrolltolower="loadMoreGood">
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id"
@click="openGoodPopup(item)">
<view class="shop-img"> <view class="shop-img">
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image> <up-image width="120rpx" height="120rpx" :src="item.imgs"></up-image>
</view> </view>
<view class="shop-content"> <view class="shop-content">
<view class="title"> <view class="title">
@ -152,7 +154,8 @@
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
import { import {
reactive, reactive,
ref ref,
onMounted
} from "vue" } from "vue"
import { import {
goodListApi, goodListApi,
@ -166,13 +169,21 @@
import viewPopup from "@/components/viewPopup.vue" import viewPopup from "@/components/viewPopup.vue"
import goodPopup from "@/components/goodPopup.vue" import goodPopup from "@/components/goodPopup.vue"
import useCartStore from "@/store/cart.js" import useCartStore from "@/store/cart.js"
import {
getCurrentInstance
} from 'vue';
/*商品列表滚动隐藏头部导航 */ /*商品列表滚动隐藏头部导航 */
const instance = getCurrentInstance(); //
const targetHeight = ref(0)
const isScroll = ref(false) const isScroll = ref(false)
let lastScollTop = 0 let lastScollTop = 0
const hideHeadView = (e) => { 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 isScroll.value = e.detail.scrollTop > lastScollTop
lastScollTop = e.detail.scrollTop lastScollTop = e.detail.scrollTop
} }
/*商品列表滚动隐藏头部导航结束 */ /*商品列表滚动隐藏头部导航结束 */
const test = () => { const test = () => {
@ -182,9 +193,7 @@
} }
const cartStore = useCartStore(); const cartStore = useCartStore();
const show = ref(0); const show = ref(0);
const topActive = ref(0); const topActive = ref(0);
const changeOne = (item, index) => { const changeOne = (item, index) => {
console.log('选择', item, index); console.log('选择', item, index);
@ -363,10 +372,33 @@
onLoad(() => { onLoad(() => {
getgoodClassList(); getgoodClassList();
getGoodList(); getGoodList();
}) })
onShow(() => { onShow(() => {
getCartList(); 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> </script>
<style lang="scss"> <style lang="scss">
@ -666,8 +698,8 @@
display: flex; display: flex;
.shop-img { .shop-img {
height: 160rpx; height: 120rpx;
width: 160rpx; width: 120rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 14rpx; border-radius: 14rpx;
overflow: hidden; overflow: hidden;
@ -687,7 +719,7 @@
.tip { .tip {
color: #999; color: #999;
font-size: 24rpx; font-size: 24rpx;
margin: 12rpx 0; margin: 2rpx 0;
} }
} }