Skip to content

Commit 49e49a1

Browse files
committed
fix: watchEffect
1 parent 8cc59a0 commit 49e49a1

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

docs/.vitepress/components/BodyScrollbar.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@ import {
55
useWindowScroll,
66
useWindowSize,
77
} from '@vueuse/core';
8-
import { computed, shallowRef, type CSSProperties } from 'vue';
8+
import { computed, shallowRef, type CSSProperties, watchEffect } from 'vue';
99
1010
const { y, x } = useWindowScroll();
1111
const { height: winH, width: winW } = useWindowSize();
1212
const body = useElementBounding(document.body);
1313
14+
watchEffect(() => {
15+
console.log([
16+
x.value,
17+
y.value,
18+
winH.value,
19+
winW.value,
20+
body.width.value,
21+
body.height.value,
22+
]);
23+
});
24+
1425
// see https://github.com/user-attachments/assets/89796d25-b360-4486-9cf7-79a5e598022c
1526
const errorDistance = 2;
1627

docs/.vitepress/plugins/mirror.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ export const transformHtml = (code: string) => {
158158
if (!code.includes('/assets/')) return;
159159
// 注意: 如果使用 htmlparser2+dom-serializer, 当 md 文件包含 `<<n` 将出现 Hydration mismatches 错误
160160
const doc = new Parser().parseFromString(code, 'text/html');
161-
// const script = doc.createElement('script');
162-
// script.textContent = `;(${rewriteAppendChild})(${JSON.stringify(mirrorBaseUrl)});`;
163-
// doc.head.insertBefore(script, doc.head.firstChild);
161+
const script = doc.createElement('script');
162+
script.textContent = `;(${rewriteAppendChild})(${JSON.stringify(mirrorBaseUrl)});`;
163+
doc.head.insertBefore(script, doc.head.firstChild);
164164
Object.entries({
165165
link: 'href',
166166
script: 'src',

0 commit comments

Comments
 (0)