mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-19 02:17:26 +08:00
Merge branch 'main' of github.com:AnNingUI/OpenIsle
This commit is contained in:
@@ -16,11 +16,7 @@
|
|||||||
<NuxtPage keepalive />
|
<NuxtPage keepalive />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div v-if="showNewPostIcon && isMobile" class="new-post-icon" @click="goToNewPost">
|
||||||
v-if="!menuVisible && route.path !== '/new-post'"
|
|
||||||
class="new-post-icon"
|
|
||||||
@click="goToNewPost"
|
|
||||||
>
|
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,61 +24,55 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import HeaderComponent from '~/components/HeaderComponent.vue'
|
import HeaderComponent from '~/components/HeaderComponent.vue'
|
||||||
import MenuComponent from '~/components/MenuComponent.vue'
|
import MenuComponent from '~/components/MenuComponent.vue'
|
||||||
import GlobalPopups from '~/components/GlobalPopups.vue'
|
import GlobalPopups from '~/components/GlobalPopups.vue'
|
||||||
import { useIsMobile } from '~/utils/screen'
|
import { useIsMobile } from '~/utils/screen'
|
||||||
|
|
||||||
export default {
|
const isMobile = useIsMobile()
|
||||||
name: 'App',
|
const menuVisible = ref(!isMobile.value)
|
||||||
components: { HeaderComponent, MenuComponent, GlobalPopups },
|
|
||||||
setup() {
|
|
||||||
const isMobile = useIsMobile()
|
|
||||||
const menuVisible = ref(!isMobile.value)
|
|
||||||
const route = useRoute()
|
|
||||||
|
|
||||||
const hideMenu = computed(() => {
|
const showNewPostIcon = computed(() => useRoute().path === '/')
|
||||||
return [
|
|
||||||
'/login',
|
|
||||||
'/signup',
|
|
||||||
'/404',
|
|
||||||
'/signup-reason',
|
|
||||||
'/github-callback',
|
|
||||||
'/twitter-callback',
|
|
||||||
'/discord-callback',
|
|
||||||
'/forgot-password',
|
|
||||||
'/google-callback',
|
|
||||||
].includes(useRoute().path)
|
|
||||||
})
|
|
||||||
|
|
||||||
const header = useTemplateRef('header')
|
const hideMenu = computed(() => {
|
||||||
|
return [
|
||||||
|
'/login',
|
||||||
|
'/signup',
|
||||||
|
'/404',
|
||||||
|
'/signup-reason',
|
||||||
|
'/github-callback',
|
||||||
|
'/twitter-callback',
|
||||||
|
'/discord-callback',
|
||||||
|
'/forgot-password',
|
||||||
|
'/google-callback',
|
||||||
|
].includes(useRoute().path)
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
const header = useTemplateRef('header')
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
menuVisible.value = window.innerWidth > 768
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const handleMenuOutside = (event) => {
|
onMounted(() => {
|
||||||
const btn = header.value.$refs.menuBtn
|
if (typeof window !== 'undefined') {
|
||||||
if (btn && (btn === event.target || btn.contains(event.target))) {
|
menuVisible.value = window.innerWidth > 768
|
||||||
return // 如果是菜单按钮的点击,不处理关闭
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
if (isMobile.value) {
|
const handleMenuOutside = (event) => {
|
||||||
menuVisible.value = false
|
const btn = header.value.$refs.menuBtn
|
||||||
}
|
if (btn && (btn === event.target || btn.contains(event.target))) {
|
||||||
}
|
return // 如果是菜单按钮的点击,不处理关闭
|
||||||
|
}
|
||||||
|
|
||||||
const goToNewPost = () => {
|
if (isMobile.value) {
|
||||||
navigateTo('/new-post', { replace: false })
|
menuVisible.value = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return { menuVisible, hideMenu, handleMenuOutside, header, route, goToNewPost }
|
const goToNewPost = () => {
|
||||||
},
|
navigateTo('/new-post', { replace: false })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style src="~/assets/global.css"></style>
|
<style src="~/assets/global.css"></style>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.header-container {
|
.header-container {
|
||||||
|
|||||||
Reference in New Issue
Block a user