From 3bbe31da1b4c32d1134cccdc024bb5cd167387e3 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 21 May 2023 22:20:21 +0800 Subject: [PATCH] docs(perf): lazy import transliteration (#11893) --- .../vant-cli/site/desktop/components/Content.vue | 11 +++++++---- .../site/mobile/components/DemoBlock.vue | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/vant-cli/site/desktop/components/Content.vue b/packages/vant-cli/site/desktop/components/Content.vue index 2fffc67dc..e290fdcbf 100644 --- a/packages/vant-cli/site/desktop/components/Content.vue +++ b/packages/vant-cli/site/desktop/components/Content.vue @@ -62,13 +62,16 @@ export default { syncMobilePos(id) { // Getting the document at this point is to ensure that the target has been fully rendered. - if (this.iframeDocument) { - const target = this.iframeDocument.getElementById(id); - target && target.scrollIntoView(true); - } else { + if (!this.iframeDocument) { const iframe = document.querySelector('iframe'); this.iframeDocument = iframe.contentWindow.document; } + if (this.iframeDocument) { + const target = this.iframeDocument.getElementById(id); + if (target) { + target.scrollIntoView(true); + } + } }, copyAction() { diff --git a/packages/vant-cli/site/mobile/components/DemoBlock.vue b/packages/vant-cli/site/mobile/components/DemoBlock.vue index 3cd9d06ee..25a3caa13 100644 --- a/packages/vant-cli/site/mobile/components/DemoBlock.vue +++ b/packages/vant-cli/site/mobile/components/DemoBlock.vue @@ -11,8 +11,6 @@