Skip to content

Commit 9fcf8c7

Browse files
authored
fix: Fix the issue where the page must be refreshed after the update (#484)
1 parent 8bfb95f commit 9fcf8c7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/.vuepress/client.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import { defineDocSearchConfig } from '@vuepress/plugin-docsearch/client';
2020
import { computed } from 'vue';
21+
import { useRouter, withBase } from 'vuepress/client';
2122
import { defineClientConfig, usePageData } from 'vuepress/client';
2223
import DocSearch from './components/DocSearch.vue';
2324
import { getDocVersion } from './utils/index.js';
@@ -28,6 +29,19 @@ export default defineClientConfig({
2829
},
2930
setup() {
3031
const pageData = usePageData();
32+
const router = useRouter();
33+
34+
let lastTo = '';
35+
36+
router.onError((error) => {
37+
console.warn(error);
38+
if(!lastTo) return;
39+
window.location.href = withBase(lastTo);
40+
lastTo = '';
41+
});
42+
router.beforeEach((to) => {
43+
lastTo = to.fullPath;
44+
});
3145

3246
const docSearchConfig = computed(() => ({
3347
appId: 'JLT9R2YGAE',

src/.vuepress/styles/index.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
* limitations under the License.
1717
*/
1818

19+
// #main-description {
20+
// max-width: 55rem;
21+
// }
22+
.vp-skip-link {
23+
z-index: 1;
24+
}
1925
.vp-hero-image {
2026
max-width: 420px;
2127
}
@@ -82,3 +88,17 @@ footer {
8288
div[class*='language-'] pre code {
8389
color: var(--code-c-text);
8490
}
91+
92+
.home {
93+
.theme-hope-content {
94+
inset: 0;
95+
z-index: 0;
96+
position: relative;
97+
background-attachment: fixed;
98+
background-position: 50%;
99+
background-size: cover;
100+
max-width: 100%;
101+
padding: 0;
102+
display: inline;
103+
}
104+
}

0 commit comments

Comments
 (0)