فهرست منبع

跳转商品详情

Xiao_123 5 ماه پیش
والد
کامیت
fa26da5a0d
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      src/views/mall/home/components/hotGoods.vue

+ 4 - 1
src/views/mall/home/components/hotGoods.vue

@@ -27,7 +27,9 @@ import { useMallStore } from '@/store/mall'
 import { getProductByIds } from '@/api/mall/index'
 import { formatSales, fen2yuan } from '@/hooks/web/useGoods'
 import { isArray } from 'lodash-es'
+import { useRouter } from 'vue-router'
 
+const router = useRouter()
 let template = ref(JSON.parse(localStorage.getItem('mallTemplate')) || {})
 useMallStore().$subscribe((mutation, state) => {
   if (state.template && Object.keys(state.template).length) template.value = state?.template
@@ -53,7 +55,8 @@ const salesAndStock = computed(() => (data) => {
 
 // 商品详情
 const handleClickGood = (val) => {
-  console.log(val, 'click-val')
+  if (!val.id) return
+  router.push(`/wareDetails/${val.id}`)
 }
 </script>