Skip to content

Commit

Permalink
fix: Fix the issue where the page must be refreshed after the update
Browse files Browse the repository at this point in the history
  • Loading branch information
CritasWang committed Dec 19, 2024
1 parent 8bfb95f commit 7b0cace
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/.vuepress/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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',
Expand Down
20 changes: 20 additions & 0 deletions src/.vuepress/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 7b0cace

Please sign in to comment.