瀏覽代碼

🐛 fix(goods): 修复商品ID类型不匹配问题

- 将商品id从number类型转换为string类型,解决类型不匹配问题
yourname 1 月之前
父節點
當前提交
d5adf94921
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      mini/src/pages/index/index.tsx

+ 2 - 2
mini/src/pages/index/index.tsx

@@ -1,4 +1,4 @@
-import React, { useState } from 'react'
+import React from 'react'
 import { View, Text, ScrollView } from '@tarojs/components'
 import { useInfiniteQuery } from '@tanstack/react-query'
 import { TabBarLayout } from '@/layouts/tab-bar-layout'
@@ -58,7 +58,7 @@ const HomePage: React.FC = () => {
   // 数据转换:将API返回的商品数据转换为GoodsData接口格式
   const convertToGoodsData = (goods: Goods): GoodsData => {
     return {
-      id: goods.id,
+      id: goods.id.toString(), // 将number类型的id转换为string
       name: goods.name,
       cover_image: goods.imageFile?.fullUrl || '',
       price: goods.price,