diff --git a/src/App.vue b/src/App.vue
index 71d1d6b..4c561a0 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,26 +2,35 @@
import { dateZhCN, zhCN } from 'naive-ui';
import { RouterView } from 'vue-router';
import ErrorDlg from './components/ErrorDlg.vue';
+import { ScrollbarWrapper } from './utils/others';
+
diff --git a/src/components/TrackDlg.vue b/src/components/TrackDlg.vue
index d5808d1..a839a51 100644
--- a/src/components/TrackDlg.vue
+++ b/src/components/TrackDlg.vue
@@ -30,7 +30,7 @@ watchEffect(() => {
v-model:show="show"
preset="dialog"
title="选择器路径视图"
- class="min-w-[calc(var(--gkd-width)*0.4)]"
+ class="min-w-[calc(var(--gkd-w)*0.4)]"
@afterLeave="onUpdateTrack()"
>
diff --git a/src/utils/others.ts b/src/utils/others.ts
index 0ff1862..dabe328 100644
--- a/src/utils/others.ts
+++ b/src/utils/others.ts
@@ -1,6 +1,8 @@
import type { LocationQuery } from 'vue-router';
import { message } from './discrete';
import root from './root';
+import { Teleport } from 'vue';
+import BodyScrollbar from '@/components/BodyScrollbar.vue';
export const obj2form = (...objs: Record[]) => {
const fd = new FormData();
@@ -64,15 +66,13 @@ export const copy = (() => {
};
})();
-export const useAdaptMobile = () => {
- const isMobile = window.innerHeight > window.innerWidth;
+export const useAutoHeight = () => {
+ const cls = 'app-auto-h';
onMounted(() => {
- if (isMobile) {
- root.classList.add('mobile');
- }
+ root.classList.add(cls);
});
onUnmounted(() => {
- root.classList.remove('mobile');
+ root.classList.remove(cls);
});
};
@@ -143,3 +143,18 @@ export const toInteger = (v: unknown): number | undefined => {
}
}
};
+
+export const ScrollbarWrapper = defineComponent(() => {
+ const show = shallowRef(false);
+ const isMobile = 'ontouchstart' in document.documentElement;
+ show.value = !isMobile;
+ if (isMobile) {
+ document.body.classList.add('mobile');
+ document.documentElement.classList.add('mobile');
+ }
+ return () => {
+ return show.value
+ ? h(Teleport, { to: document.body }, h(BodyScrollbar))
+ : undefined;
+ };
+});
diff --git a/src/utils/size.ts b/src/utils/size.ts
index 71abdc1..6fa12cd 100644
--- a/src/utils/size.ts
+++ b/src/utils/size.ts
@@ -2,8 +2,8 @@ const windowSize = useWindowSize();
export const vw = computed(() => windowSize.width.value / 100);
// const vh = computed(() => windowSize.width.value / 100);
-// --gkd-width: max(1200px, 100vw);
+// --gkd-w: max(1200px, 100vw);
export const gkdWidth = computed(() => Math.max(1200, windowSize.width.value));
-// --gkd-height: max(700px, 100vh);
+// --gkd-h: max(700px, 100vh);
export const gkdHeight = computed(() => Math.max(700, windowSize.height.value));
diff --git a/src/views/SelectorPage.vue b/src/views/SelectorPage.vue
index 90f91af..c3c1bfa 100644
--- a/src/views/SelectorPage.vue
+++ b/src/views/SelectorPage.vue
@@ -1,8 +1,14 @@
diff --git a/src/views/snapshot/AttrCard.vue b/src/views/snapshot/AttrCard.vue
index c58c7d6..fb299b4 100644
--- a/src/views/snapshot/AttrCard.vue
+++ b/src/views/snapshot/AttrCard.vue
@@ -165,7 +165,7 @@ const selectText = computed(() => {