fix
This commit is contained in:
parent
4be0fa47d5
commit
80f71389cc
@ -5,6 +5,7 @@ VerticalNavGroup,
|
|||||||
VerticalNavLink,
|
VerticalNavLink,
|
||||||
VerticalNavSectionTitle,
|
VerticalNavSectionTitle,
|
||||||
} from '@layouts/components'
|
} from '@layouts/components'
|
||||||
|
import VerticalNavDropdown from '@layouts/components/VerticalNavDropdown.vue'
|
||||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||||
import { injectionKeyIsVerticalNavHovered } from '@layouts/symbols'
|
import { injectionKeyIsVerticalNavHovered } from '@layouts/symbols'
|
||||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||||
@ -44,9 +45,10 @@ const configStore = useLayoutConfigStore()
|
|||||||
const resolveNavItemComponent = item => {
|
const resolveNavItemComponent = item => {
|
||||||
if ('heading' in item)
|
if ('heading' in item)
|
||||||
return VerticalNavSectionTitle
|
return VerticalNavSectionTitle
|
||||||
|
if ('children' in item && item.isDropdownButton)
|
||||||
|
return VerticalNavDropdown
|
||||||
if ('children' in item)
|
if ('children' in item)
|
||||||
return VerticalNavGroup
|
return VerticalNavGroup
|
||||||
|
|
||||||
return VerticalNavLink
|
return VerticalNavLink
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,6 +173,7 @@ const hideTitleAndIcon = configStore.isVerticalNavMini(isHovered)
|
|||||||
|
|
||||||
<slot name="after-nav-items" />
|
<slot name="after-nav-items" />
|
||||||
</Component>
|
</Component>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -266,4 +269,7 @@ const hideTitleAndIcon = configStore.isVerticalNavMini(isHovered)
|
|||||||
transition: transform 0.25s ease-in-out;
|
transition: transform 0.25s ease-in-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.v-icon {
|
||||||
|
margin-right: 8px; /* Adds space between the icon and the text */
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
83
resources/js/@layouts/components/VerticalNavDropdown.vue
Normal file
83
resources/js/@layouts/components/VerticalNavDropdown.vue
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<template>
|
||||||
|
<li class="nav-item" :class="item.class?item.class:''">
|
||||||
|
|
||||||
|
<div class="demo-space-x">
|
||||||
|
<VMenu transition="scale-transition">
|
||||||
|
<template #activator="{ props }">
|
||||||
|
<Component
|
||||||
|
:is="itemIcon(item)"
|
||||||
|
v-if="!hideTitleAndIcon && item.icon"
|
||||||
|
:class="itemIconClass(item)"
|
||||||
|
/>
|
||||||
|
<VBtn v-bind="props" block >
|
||||||
|
<VIcon v-if="item.icon" :icon="item.icon.icon" class="mr-2" />{{ item.title }}
|
||||||
|
</VBtn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<VList class="list-reset">
|
||||||
|
<VListItem
|
||||||
|
v-for="(child, index) in item.children"
|
||||||
|
:key="index"
|
||||||
|
class="list-item-reset"
|
||||||
|
>
|
||||||
|
|
||||||
|
<VerticalNavLink :item="child" :hideTitleAndIcon="hideTitleAndIcon" :class="item.class" />
|
||||||
|
</VListItem>
|
||||||
|
</VList>
|
||||||
|
</VMenu>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import VerticalNavLink from './VerticalNavLink.vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
hideTitleAndIcon: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
hideMarker: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const itemIcon = (item) => {
|
||||||
|
return item.icon.icon ? item.icon.icon : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemIconClass = (item) => {
|
||||||
|
return item.icon ? item.icon.class : ''
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
.list-reset {
|
||||||
|
list-style: none; /* Removes bullets or numbers from the list */
|
||||||
|
padding: 0; /* Removes default padding */
|
||||||
|
margin: 0px; /* Removes default margin */
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item-reset {
|
||||||
|
list-style: none; /* Ensures each list item has no bullets or numbers */
|
||||||
|
padding: 0; /* Removes default padding */
|
||||||
|
margin: 0px; /* Removes default margin */
|
||||||
|
}
|
||||||
|
.nav-item > .v-menu {
|
||||||
|
width: 100%; /* Ensures the menu takes the full width */
|
||||||
|
}
|
||||||
|
.bottom-end button {
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
@ -52,29 +52,38 @@ export default [
|
|||||||
to: 'admin-medicines',
|
to: 'admin-medicines',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: 'Settings',
|
title: 'Settings',
|
||||||
icon: { icon: 'ri-settings-4-line' },
|
icon: { icon: 'ri-settings-4-line' },
|
||||||
class: 'bottom-end',
|
class: 'bottom-end',
|
||||||
|
isDropdownButton: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Profile',
|
title: 'Profile',
|
||||||
to: 'admin-profile',
|
to: 'admin-profile',
|
||||||
|
icon: {
|
||||||
|
icon: 'ri-group-line',
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Security',
|
title: 'Security',
|
||||||
to: 'admin-change-password',
|
to: 'admin-change-password',
|
||||||
|
icon: {
|
||||||
|
icon: 'ri-shield-keyhole-line',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Site Setting',
|
title: 'Site Setting',
|
||||||
to: 'admin-site-setting',
|
to: 'admin-site-setting',
|
||||||
|
icon: {
|
||||||
|
icon: 'ri-settings-4-line',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
},
|
}
|
||||||
|
|
||||||
|
|
||||||
// {
|
// {
|
||||||
|
Loading…
Reference in New Issue
Block a user