fix(components): make navbar show up properly
This commit is contained in:
parent
d5de2499ab
commit
14d9d12e5b
@ -3,9 +3,9 @@
|
||||
import { MenuProps } from "ant-design-vue";
|
||||
|
||||
const { data, status } = useAuth();
|
||||
const itemMap = {
|
||||
const itemMap = ref({
|
||||
home: "/",
|
||||
bands: "bands",
|
||||
bands: "/bands",
|
||||
authors: "/authors",
|
||||
forum: "/forum",
|
||||
account: "/my-stuff",
|
||||
@ -17,18 +17,19 @@
|
||||
profile: `/user/${data?.value?.user?._id || 0}`,
|
||||
admin: "/admin",
|
||||
logout: "/logout",
|
||||
};
|
||||
});
|
||||
let cur = ref<string>(
|
||||
Object.keys(itemMap).find((a) => itemMap[a] === useRoute().path) ||
|
||||
useRoute().path,
|
||||
Object.keys(itemMap.value).find(
|
||||
(a) => itemMap.value[a] === useRoute().path,
|
||||
) || useRoute().path,
|
||||
);
|
||||
let selected: string[] = [cur.value];
|
||||
|
||||
const clickFn = (minfo) => {
|
||||
if (itemMap[minfo.key] === undefined) return;
|
||||
cur.value = itemMap[minfo.key];
|
||||
if (itemMap.value[minfo.key] === undefined) return;
|
||||
cur.value = itemMap.value[minfo.key];
|
||||
selected = [cur.value];
|
||||
navigateTo(itemMap[minfo.key]);
|
||||
navigateTo(itemMap.value[minfo.key]);
|
||||
};
|
||||
console.log({ label: "client", value: cur.value, stat: status.value });
|
||||
</script>
|
||||
@ -67,15 +68,14 @@
|
||||
</a-menu>
|
||||
<div>
|
||||
<a-button
|
||||
v-if="!!data?.user"
|
||||
v-if="data?.user"
|
||||
type="primary"
|
||||
:style="{}"
|
||||
tooltip="Post a new Story"
|
||||
@click="() => navigateTo('/new-story')"
|
||||
>
|
||||
<template #icon>
|
||||
<icon istyle="regular" name="file-plus" />
|
||||
</template>
|
||||
<!-- <template #icon>
|
||||
</template> -->
|
||||
<icon istyle="regular" name="file-plus" />
|
||||
<span style="margin-left: 0.5em"> Post a new Story </span>
|
||||
</a-button>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user