Skip to content

Commit

Permalink
Merge pull request #58 from chengpeiquan/develop
Browse files Browse the repository at this point in the history
Update Header on mobile.
  • Loading branch information
chengpeiquan authored Feb 24, 2021
2 parents 77972a3 + e048647 commit b99c538
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- 站点导航 - 移动端 -->
<nav
v-if="isMobile"
class="nav flex flex-1 justify-end items-center text-xl"
class="nav flex flex-1 justify-end items-center text-base"
>
<!-- 主导航按钮 -->
<a class="select-none mr-4" @click="toggleMenu">
Expand All @@ -37,7 +37,7 @@
<li
v-for="(item, index) in navList"
:key="index"
class="flex items-center w-1/3 h-10 text-sm"
class="flex items-center w-1/3 h-12 text-sm"
>
<router-link
:to="item.target"
Expand Down Expand Up @@ -103,7 +103,8 @@
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import isDark from '/@libs/isDark'
import isMobile from '/@libs/isMobile'
Expand All @@ -127,11 +128,17 @@ const navList: NavList = [
}
];
// 移动端菜单开关
const isShowMenu = ref<boolean>(false);
const toggleMenu = (): void => {
isShowMenu.value = !isShowMenu.value;
}
// 移动端切换路由后关闭菜单
const router = useRouter();
router.afterEach( () => {
isShowMenu.value = false;
})
</script>

<style lang="postcss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ToggleTheme.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<a
class="select-none text-xl"
class="select-none md:text-xl text-base"
:title="`切换到${ isDark ? '普通' : '暗黑' }模式`"
@click="toggleTheme"
>
Expand Down

0 comments on commit b99c538

Please sign in to comment.