Browse Source

优化商品详情页面对比价格列表点击跳转功能,添加更多调试信息

pull/12/head
徐飞洋 2 months ago
parent
commit
a650994773
  1. 13
      pages/goods-detail/goods-detail.js

13
pages/goods-detail/goods-detail.js

@ -507,16 +507,27 @@ Page({
const item = e.currentTarget.dataset.item; const item = e.currentTarget.dataset.item;
if (!item) { if (!item) {
console.error('点击的商品项数据不存在'); console.error('点击的商品项数据不存在');
wx.showToast({
title: '商品信息有误',
icon: 'none'
});
return; return;
} }
// 获取商品ID // 获取商品ID
const productId = item.id || item.productId; const productId = item.id || item.productId;
if (!productId) { if (!productId) {
console.error('商品ID不存在'); console.error('商品ID不存在:', item);
wx.showToast({
title: '商品ID不存在',
icon: 'none'
});
return; return;
} }
console.log('点击商品项信息:', item);
console.log('获取到的商品ID:', productId, '类型:', typeof productId);
// 跳转到商品详情页 // 跳转到商品详情页
wx.navigateTo({ wx.navigateTo({
url: `/pages/goods-detail/goods-detail?productId=${productId}`, url: `/pages/goods-detail/goods-detail?productId=${productId}`,

Loading…
Cancel
Save