This is an automated email from the ASF dual-hosted git repository.

critas pushed a commit to branch wx_fix_router
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git

commit 7b0caceb5e7e90863019cc8da84570bd259e3d60
Author: CritasWang <[email protected]>
AuthorDate: Thu Dec 19 15:27:16 2024 +0800

    fix: Fix the issue where the page must be refreshed after the update
---
 src/.vuepress/client.ts         | 14 ++++++++++++++
 src/.vuepress/styles/index.scss | 20 ++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/src/.vuepress/client.ts b/src/.vuepress/client.ts
index 7464fa71..2cac38ff 100644
--- a/src/.vuepress/client.ts
+++ b/src/.vuepress/client.ts
@@ -18,6 +18,7 @@
 
 import { defineDocSearchConfig } from '@vuepress/plugin-docsearch/client';
 import { computed } from 'vue';
+import { useRouter, withBase } from 'vuepress/client';
 import { defineClientConfig, usePageData } from 'vuepress/client';
 import DocSearch from './components/DocSearch.vue';
 import { getDocVersion } from './utils/index.js';
@@ -28,6 +29,19 @@ export default defineClientConfig({
   },
   setup() {
     const pageData = usePageData();
+    const router = useRouter();
+
+    let lastTo  = '';
+    
+    router.onError((error) => {
+      console.warn(error);
+      if(!lastTo) return;
+      window.location.href = withBase(lastTo);
+      lastTo = '';
+    });
+    router.beforeEach((to) => {
+      lastTo = to.fullPath;
+    });
 
     const docSearchConfig = computed(() => ({
       appId: 'JLT9R2YGAE',
diff --git a/src/.vuepress/styles/index.scss b/src/.vuepress/styles/index.scss
index 072e55dc..e36ad3a3 100644
--- a/src/.vuepress/styles/index.scss
+++ b/src/.vuepress/styles/index.scss
@@ -16,6 +16,12 @@
  * limitations under the License.
  */
 
+// #main-description {
+//   max-width: 55rem;
+// }
+.vp-skip-link {
+  z-index: 1;
+}
 .vp-hero-image {
   max-width: 420px;
 }
@@ -82,3 +88,17 @@ footer {
 div[class*='language-'] pre code {
   color: var(--code-c-text);
 }
+
+.home {
+  .theme-hope-content {
+    inset: 0;
+    z-index: 0;
+    position: relative;
+    background-attachment: fixed;
+    background-position: 50%;
+    background-size: cover;
+    max-width: 100%;
+    padding: 0;
+    display: inline;
+  }
+}
\ No newline at end of file

Reply via email to