From 0fdb4c234a5c141407bd95c28877e621d691e7d4 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 11 Aug 2025 01:08:44 +0800 Subject: [PATCH] feat: fix menu show --- frontend_nuxt/app.vue | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/frontend_nuxt/app.vue b/frontend_nuxt/app.vue index eb6479661..cd3406e17 100644 --- a/frontend_nuxt/app.vue +++ b/frontend_nuxt/app.vue @@ -24,13 +24,10 @@ import GlobalPopups from '~/components/GlobalPopups.vue' export default { name: 'App', components: { HeaderComponent, MenuComponent, GlobalPopups }, - data() { - return { - menuVisible: true - } - }, - computed: { - hideMenu() { + setup() { + const isMobile = useIsMobile() + const menuVisible = ref(!isMobile.value) + const hideMenu = computed(() => { return [ '/login', '/signup', @@ -41,15 +38,17 @@ export default { '/discord-callback', '/forgot-password', '/google-callback' - ].includes(this.$route.path) - } + ].includes(useRoute().path) + }) + + onMounted(() => { + if (typeof window !== 'undefined') { + menuVisible.value = window.innerWidth > 768 + } + }) + + return { menuVisible, hideMenu } }, - async mounted() { - if (typeof window !== 'undefined') { - this.menuVisible = window.innerWidth > 768 - } - }, - methods: {} }