|
@@ -9,6 +9,7 @@ import { goodsClient, advertisementClient } from '@/api'
|
|
|
import { InferResponseType } from 'hono'
|
|
import { InferResponseType } from 'hono'
|
|
|
import './index.css'
|
|
import './index.css'
|
|
|
import { Carousel } from '@/components/ui/carousel'
|
|
import { Carousel } from '@/components/ui/carousel'
|
|
|
|
|
+import Taro from '@tarojs/taro'
|
|
|
|
|
|
|
|
type GoodsResponse = InferResponseType<typeof goodsClient.$get, 200>
|
|
type GoodsResponse = InferResponseType<typeof goodsClient.$get, 200>
|
|
|
type Goods = GoodsResponse['data'][0]
|
|
type Goods = GoodsResponse['data'][0]
|
|
@@ -103,10 +104,15 @@ const HomePage: React.FC = () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- // 商品点击
|
|
|
|
|
- const handleGoodsClick = (goods: GoodsData, index: number) => {
|
|
|
|
|
- console.log('点击商品:', goods, index)
|
|
|
|
|
|
|
+ // // 商品点击
|
|
|
|
|
+ // const handleGoodsClick = (goods: GoodsData, index: number) => {
|
|
|
|
|
+ // console.log('点击商品:', goods, index)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // 跳转到商品详情
|
|
|
|
|
+ const handleGoodsClick = (goods: Goods) => {
|
|
|
|
|
+ Taro.navigateTo({
|
|
|
|
|
+ url: `/pages/goods-detail/index?id=${goods.id}`
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 添加购物车
|
|
// 添加购物车
|