12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <script setup lang="ts">
- import { modules as blogModules, router } from '@/router';
- import { computed } from 'vue';
- const currentRouteName = computed(() => router.currentRoute.value.name);
- </script>
- <template>
- <div class="nav" >
- <div class="module-wrapper" v-for="m of blogModules" :key="m.routeName" @click="router.push(m.routeUrl)">
- <div :class="(currentRouteName == m.routeName) ? ['module-active-icon-wrapper'] : ['icon-wrapper']">
- <div v-html="m.iconTemplate" class="module-icon"/>
- </div>
- <div class="module-item">{{ m.title }}</div>
- </div>
- </div>
- </template>
- <style scoped>
- .module-icon {
- width: 16px;
- height: 16px;
- display: flex
- }
- .nav {
- display: flex;
- flex-direction: column;
- gap: 10px;
- transition: all .3s;
- }
- .module-wrapper {
- display: flex;
- align-items: center;
- cursor: pointer;
- border-radius: 12px;
- background: transparent;
- padding: 0 0 0 12px;
- transition: all .3s;
- }
- .module-wrapper:hover {
- background: #f0f0f0;
- }
- .module-item {
- display: flex;
- text-decoration: none;
- color: #333;
- padding: 10px 12px;
- transition: all .3s;
- }
- @media screen and (max-width: 800px) {
- .nav {
- flex-direction: row;
- gap: 5px;
- overflow-y: hidden;
- overflow-x: auto;
- white-space: nowrap;
- }
- .module-item {
- line-height: 50px;
- padding: 0 20px 0 12px;
- }
- }
- .icon-wrapper {
- height: 32px;
- width: 32px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 12px;
- transition: .3s all;
- }
- .module-active-icon-wrapper {
- background: #F0F0F0;
- border-radius: 12px;
- width: 32px;
- height: 32px;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: .3s all;
- }
- </style>
|