From a4fa38deee1718a2b5f0ecb024fa30ce01663560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Sat, 10 Oct 2020 00:25:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A9=BA=E5=80=BC=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/view/article/article.component.ts | 5 ++--- src/app/view/write/write.component.html | 4 ---- src/app/view/write/write.module.ts | 7 ++++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/app/view/article/article.component.ts b/src/app/view/article/article.component.ts index 73e7558..f12b52e 100644 --- a/src/app/view/article/article.component.ts +++ b/src/app/view/article/article.component.ts @@ -73,9 +73,8 @@ export class ArticleComponent implements OnInit { after: () => { // 处理锚点 const tocList: HTMLCollection = this.divElement.nativeElement - .getElementsByClassName('vditor-toc')[0] - .getElementsByTagName(`a`); - for (let i = 0; i < tocList.length; i++) { + .getElementsByClassName('vditor-toc')[0]?.getElementsByTagName(`a`); + for (let i = 0; i < tocList?.length; i++) { const linkValue = tocList.item(i).getAttribute('href'); tocList.item(i).setAttribute('href', window.location.pathname + linkValue); } diff --git a/src/app/view/write/write.component.html b/src/app/view/write/write.component.html index 1c658c4..57e9328 100644 --- a/src/app/view/write/write.component.html +++ b/src/app/view/write/write.component.html @@ -4,10 +4,6 @@
- - - -