Merge branch 'dev' into 'master'

uniapp【修复】:首页商品tab组,默认没有显示数据问题

See merge request jianweie/coreshoppro!101
This commit is contained in:
花城
2024-11-27 02:34:22 +00:00

View File

@@ -13,7 +13,8 @@
<template #goodPrice> <template #goodPrice>
<view class="price-msg" v-if="goodsState.column == 1" @click="hanldeClickGoods(item)"> <view class="price-msg" v-if="goodsState.column == 1" @click="hanldeClickGoods(item)">
<view class="tag-box"> <view class="tag-box">
<view class="tag tag-buy">已售{{ item.buyCount+item.initialSales }}{{ item.unit }}</view> <view class="tag tag-buy">已售{{ item.buyCount+item.initialSales }}{{ item.unit }}
</view>
<view class="tag tag-view">{{ item.viewCount }}人访问</view> <view class="tag tag-view">{{ item.viewCount }}人访问</view>
</view> </view>
<view class="price-box"> <view class="price-box">
@@ -46,7 +47,7 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, watch } from 'vue'; import { reactive, watchEffect } from 'vue';
import Point from '../home-goods/point.vue'; import Point from '../home-goods/point.vue';
import { handleRouteNavigateTo, splitArrayByStep } from '@/core/utils'; import { handleRouteNavigateTo, splitArrayByStep } from '@/core/utils';
@@ -64,7 +65,12 @@
column: 1, column: 1,
}) })
watch(() => props.data.list[0], () => { const hanlderChangeTab = (e : any) => {
goodsState.column = e.column;
goodsState.goodsList = splitArrayByStep(e.list.slice(0, e.limit), e.column);
}
watchEffect(() => {
hanlderChangeTab(props.data.list?.[0]); hanlderChangeTab(props.data.list?.[0]);
}) })
@@ -92,11 +98,6 @@
} }
} }
const hanlderChangeTab = (e : any) => {
goodsState.column = e.column;
goodsState.goodsList = splitArrayByStep(e.list.slice(0, e.limit), e.column);
}
const hanldeClickGoods = (data : any) => { const hanldeClickGoods = (data : any) => {
handleRouteNavigateTo(`/pages/goods/detail?id=${data?.id}`) handleRouteNavigateTo(`/pages/goods/detail?id=${data?.id}`)
} }