[core] change style of menulinks in drawer
This commit is contained in:
parent
a8a6cd8814
commit
81c5b10101
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<q-expansion-item v-if="isGranted(entry)" clickable tag="a" target="self" :label='title' :icon='entry.icon' expand-separator>
|
||||
<q-list class='q-ml-lg'>
|
||||
<div v-for='child in entry.children' :key='child.link'>
|
||||
<q-item v-if='isGranted(child)' clickable :to='{name: child.link}'>
|
||||
<q-item-section avatar>
|
||||
<q-icon :name='child.icon' />
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
{{child.title}}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
</q-list>
|
||||
</q-expansion-item>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, onMounted, PropType } from 'vue';
|
||||
import { hasPermissions } from 'src/utils/permission';
|
||||
import { FG_Plugin } from 'src/plugins';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'EssentialExpansionLink',
|
||||
components: { },
|
||||
props: {
|
||||
entry: {
|
||||
type: Object as PropType<FG_Plugin.MenuLink>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
function isGranted(val: FG_Plugin.MenuLink) { return hasPermissions(val.permissions || [])};
|
||||
const title = computed(() =>
|
||||
typeof props.entry.title === 'object' ? props.entry.title.value : props.entry.title
|
||||
);
|
||||
onMounted(() => {
|
||||
console.log(props.entry.children)
|
||||
})
|
||||
return { isGranted, title };
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -51,18 +51,18 @@
|
|||
>
|
||||
<!-- Plugins -->
|
||||
<q-list>
|
||||
<essential-link
|
||||
v-for="(entry, index) in mainLinks"
|
||||
<essential-expansion-link
|
||||
v-for="(entry, index) in menuLinks"
|
||||
:key="'plugin' + index"
|
||||
:entry="entry"
|
||||
/>
|
||||
<q-separator />
|
||||
<!-- Plugin functions -->
|
||||
<!--<q-separator />
|
||||
Plugin functions
|
||||
<essential-link
|
||||
v-for="(entry, index) in subLinks"
|
||||
:key="'childPlugin' + index"
|
||||
:entry="entry"
|
||||
/>
|
||||
/>-->
|
||||
</q-list>
|
||||
<q-separator />
|
||||
<essential-link
|
||||
|
@ -87,6 +87,7 @@ import { FG_Plugin } from 'src/plugins';
|
|||
import { useRouter } from 'vue-router';
|
||||
import { Screen } from 'quasar';
|
||||
import config from 'src/config';
|
||||
import EssentialExpansionLink from 'components/navigation/EssentialExpansionLink.vue';
|
||||
|
||||
const essentials: FG_Plugin.MenuLink[] = [
|
||||
{
|
||||
|
@ -98,7 +99,7 @@ const essentials: FG_Plugin.MenuLink[] = [
|
|||
|
||||
export default defineComponent({
|
||||
name: 'MainLayout',
|
||||
components: { EssentialLink, ShortcutLink, Notification },
|
||||
components: { EssentialExpansionLink, EssentialLink, ShortcutLink, Notification },
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const mainStore = useMainStore();
|
||||
|
@ -170,6 +171,7 @@ export default defineComponent({
|
|||
leftDrawer,
|
||||
leftDrawerMini,
|
||||
logout,
|
||||
menuLinks: computed(() => flaschengeist?.menuLinks),
|
||||
mainLinks,
|
||||
notifications,
|
||||
noPermission,
|
||||
|
|
|
@ -95,7 +95,7 @@ export default defineComponent({
|
|||
const status = await mainStore.login(userid.value, password.value);
|
||||
|
||||
if (status === true) {
|
||||
mainStore.user = (await useUserStore().getUser(userid.value)) || undefined;
|
||||
mainStore.user = (await useUserStore().getUser(userid.value, true)) || undefined;
|
||||
const x = router.currentRoute.value.query['redirect'];
|
||||
void router.push(typeof x === 'string' ? { path: x } : mainRoute);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue