Procházet zdrojové kódy

fix: 修复 CoreProducts 和 ProductionSoft 组件中由于 productUrl 可能为 null 导致的 TypeScript 编译错误

nahida před 1 měsícem
rodič
revize
ce5b96239b

+ 1 - 1
src/components/CoreProducts.tsx

@@ -12,7 +12,7 @@ export default function CoreProducts({products}: ProductMenuProps) {
   const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || ''
   const REMOTE_BASE_URL = process.env.NEXT_PUBLIC_REMOTE_BASE_URL || 'http://47.107.107.47:8040'
 
-  const getProductImageUrl = (url?: string) => {
+  const getProductImageUrl = (url?: string | null) => {
     let coverImageUrl = url || '';
     if (coverImageUrl) {
       if (coverImageUrl.startsWith('http')) {

+ 1 - 1
src/components/ProductionSoft.tsx

@@ -10,7 +10,7 @@ function ProductionSoft({products}: {products: ProductCategory[]}) {
   const REMOTE_BASE_URL = process.env.NEXT_PUBLIC_REMOTE_BASE_URL || 'http://47.107.107.47:8040'
   const [isMobile, setIsMobile] = useState(false);
 
-  const getProductImageUrl = (url?: string) => {
+  const getProductImageUrl = (url?: string | null) => {
     let coverImageUrl = url || '';
     if (coverImageUrl) {
       if (coverImageUrl.startsWith('http')) {