From 29082d1f5ffd11df062bc3d4f86e827e9e4f41c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Mon, 26 Jun 2023 14:43:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Component/partner.jsx | 13 ++++++++----- src/forge/Information/Pages/newsDetail.jsx | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/forge/Information/Component/partner.jsx b/src/forge/Information/Component/partner.jsx index 699d9f187..9cced7031 100644 --- a/src/forge/Information/Component/partner.jsx +++ b/src/forge/Information/Component/partner.jsx @@ -22,17 +22,20 @@ function Partner(props) { },[id]) function getUnit(array){ - const newArray = array.map(e => { + const newArray = [] + for(let i in array) { + let e = array[i] if (e.zonePartnersList && e.zonePartnersList.length > 0) { e.zonePartnersList[0].typeName = e.typeName } - return e.zonePartnersList - }) + if ( e.zonePartnersList.length > 0 ) { + newArray.push(e.zonePartnersList) + } + } while(newArray[1] && newArray[1].length + newArray[0].length <= 5) { newArray[0] = [...newArray[0], ...newArray.splice(1, 1)] } - console.log(newArray) setTopics(newArray) } @@ -47,7 +50,7 @@ function Partner(props) { i.map((j,k1)=>{ return(
- { j.typeName && {j.typeName}} + { j.typeName && topics.length > 1 && {j.typeName}}
) diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index ce20aae94..a6a9d58b6 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -45,7 +45,7 @@ function NewsDetail(props){

{detail.name}