From 413a90973a57ecc4300522a520a9123bb8050ca7 Mon Sep 17 00:00:00 2001 From: huangjihua Date: Fri, 25 Aug 2023 11:14:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:bug:=20fix(slots-foolter-index):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DFooter=E4=B8=AD=E6=94=AF=E6=8C=81=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=20columns=20=E6=95=B0=E6=8D=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/slots/Footer/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/slots/Footer/index.tsx b/src/slots/Footer/index.tsx index d58ec5b..0d6317a 100644 --- a/src/slots/Footer/index.tsx +++ b/src/slots/Footer/index.tsx @@ -19,10 +19,9 @@ const Footer: FC = () => { const footer = themeConfig.footerConfig as IFooter; - const columns = - footer?.columns === false - ? undefined - : getColumns({ github: githubUrl || (pkg as any).homepage }); + const columns = footer?.columns + ? footer.columns + : getColumns({ github: githubUrl || (pkg as any).homepage }); const bottomFooter = footer?.bottom || themeConfig.footer; const copyright = footer?.copyright || `Copyright © 2022-${new Date().getFullYear()}`; From 5dbf79082c2b0e76f1010039312054af3bc02465 Mon Sep 17 00:00:00 2001 From: huangjihua Date: Sat, 26 Aug 2023 01:07:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:sparkles:=20feat(slots-footer-index):=20?= =?UTF-8?q?=E6=89=A9=E5=B1=95cloumns=20=E4=B8=AD=E7=9A=84=20icon=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=80=9A=E8=BF=87=E9=85=8D=E7=BD=AE=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=9D=A5=E5=91=88=E7=8E=B0=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/slots/Footer/index.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/slots/Footer/index.tsx b/src/slots/Footer/index.tsx index 0d6317a..4ed81ee 100644 --- a/src/slots/Footer/index.tsx +++ b/src/slots/Footer/index.tsx @@ -23,6 +23,28 @@ const Footer: FC = () => { ? footer.columns : getColumns({ github: githubUrl || (pkg as any).homepage }); + // icons 为图片地址时,转为HTMLElement 函数 + const updateIconToImgElement = (item: any) => { + if ( + item?.icon && + typeof item.icon === 'string' && + item.icon.match(/\.(png|jpeg|jpg|gif|svg|webp)$/) !== null + ) { + item.icon = ; + } + }; + // 递归函数 + const updateIconsRecursively = (item: any) => { + updateIconToImgElement(item); + if (item?.items && item.items instanceof Array) { + item.items.forEach((_item: any) => { + updateIconsRecursively(_item); + }); + } + }; + // 处理图片地址 + columns.forEach(updateIconsRecursively); + const bottomFooter = footer?.bottom || themeConfig.footer; const copyright = footer?.copyright || `Copyright © 2022-${new Date().getFullYear()}`; return (