diff --git a/src/App.vue b/src/App.vue
index 4c561a0..76e3479 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -21,16 +21,18 @@ $winMinHeight: 700px;
}
body {
- &:not(.mobile) {
- width: var(--gkd-w);
+ width: var(--gkd-w);
+ &.body-auto-w {
+ --gkd-w: 100vw;
}
}
#app {
display: flex;
flex-direction: column;
- &:not(.app-auto-h) {
- height: var(--gkd-h);
+ height: var(--gkd-h);
+ &.app-auto-h {
+ --gkd-h: auto;
}
}
.gkd_code,
diff --git a/src/utils/others.ts b/src/utils/others.ts
index dabe328..ba64bb8 100644
--- a/src/utils/others.ts
+++ b/src/utils/others.ts
@@ -66,16 +66,24 @@ export const copy = (() => {
};
})();
-export const useAutoHeight = () => {
- const cls = 'app-auto-h';
+const useAutoCls = (el: Element, cls: string) => {
+ el.classList.add(cls);
onMounted(() => {
- root.classList.add(cls);
+ el.classList.add(cls);
});
onUnmounted(() => {
- root.classList.remove(cls);
+ el.classList.remove(cls);
});
};
+export const useAutoHeight = () => {
+ useAutoCls(root, 'app-auto-h');
+};
+
+export const useAutoWidth = () => {
+ useAutoCls(document.body, 'body-auto-w');
+};
+
export const timeAgo = (date: number) => {
const seconds = Math.floor((Date.now() - date) / 1000);
const interval = Math.floor(seconds / 31536000);
diff --git a/src/views/SelectorPage.vue b/src/views/SelectorPage.vue
index c3c1bfa..b3642d6 100644
--- a/src/views/SelectorPage.vue
+++ b/src/views/SelectorPage.vue
@@ -1,14 +1,18 @@
-
-
- {{ Math.random() }}
-
+