I have been attempting to hide an admin menu by utilizing the v-show
directive. Even though the value of isAdmin
is false in the code snippet below, the menu continues to be displayed. I have also experimented with using v-if
, but it doesn't seem to work either.
<v-list v-show="isAdmin">
<v-list-item v-for="item in adminItems" :key="item.title" @click="handleNavigtion(item)" router>
<v-list-item-action class="pr-1 pl-2 mr-1">
<v-icon :class="activeMenuItem.includes(item.title) ? 'blue--text' : ''" :title="item.title">
{{ item.icon }}
</v-icon>
</v-list-item-action>
<v-list-item-content :class="activeMenuItem.includes(item.title) ? 'blue--text' : ''">
<v-list-item-title v-text="item.title"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
I even attempted putting the v-show/if
within the v-list-item
element.
<v-list-item v-if="isAdmin" v-for="item in adminItems">...</v-list-item>
In addition, the component employs Typescript's get
method to create isAdmin
as a computed property. When trying to access this in the template using
{{ isAdmin }}
, it correctly displays either true
or false
.
get isAdmin() {
return sessionStorage.getItem('isAdmin')
}
If anyone could provide insight into what may be missing, it would be greatly appreciated.
Thank you for any assistance!