This commit is contained in:
liu
2026-08-21 12:41:15 +08:00
parent 8a7bdca6b1
commit 4bbe92d8e8
6 changed files with 50 additions and 13 deletions
+6 -1
View File
@@ -102,6 +102,11 @@ export default function IndexPage() {
Taro.switchTab({ url: '/pages/product/index' })
}, [])
/** 跳转商品详情 */
const goDetail = useCallback((id: number) => {
Taro.navigateTo({ url: `/pages/product-detail/index?id=${id}` })
}, [])
/** 搜索框聚焦/提交 → 商品页搜索 */
const handleSearchFocus = useCallback(() => {
goProduct(keyword.trim())
@@ -240,7 +245,7 @@ export default function IndexPage() {
) : (
<View className='product-grid'>
{products.map(product => (
<View key={product.id} className='product-card' onClick={() => goProduct()}>
<View key={product.id} className='product-card' onClick={() => goDetail(product.id)}>
<Image
className='product-card__image'
src={getProductCover(product) || 'https://img.yzcdn.cn/vant/cat.jpeg'}