feat: 测试markdown

This commit is contained in:
chenchun
2025-12-12 19:38:27 +08:00
parent cc812ba2cb
commit 21ef1d51a6
78 changed files with 12033 additions and 51 deletions

View File

@@ -0,0 +1,29 @@
// useScrollDetector.ts
import type { Ref } from 'vue';
import { onBeforeUnmount, onMounted, ref } from 'vue';
export default (elementRef: Ref<HTMLElement | null | undefined>) => {
const hasVertical = ref(false);
const hasHorizontal = ref(false);
const check = () => {
const el = elementRef.value;
if (!el)
return;
hasVertical.value = el.scrollHeight > el.clientHeight;
hasHorizontal.value = el.scrollWidth > el.clientWidth;
};
onMounted(() => {
check();
const observer = new ResizeObserver(check);
observer.observe(elementRef.value!);
onBeforeUnmount(() => observer.disconnect());
});
return {
hasVertical, // 是否有纵向滚动条
hasHorizontal, // 是否有横向滚动条
check, // 检查滚动条状态
};
};