Refactor #4739 - For Menu

This commit is contained in:
tugcekucukoglu 2023-11-08 15:48:47 +03:00
parent 7ffb1452aa
commit be33e737a1
5 changed files with 6 additions and 34 deletions

View file

@ -13,14 +13,7 @@
>
<div :class="cx('content')" @click="onItemClick($event)" v-bind="getPTOptions('content')">
<template v-if="!templates.item">
<router-link v-if="item.to && !disabled()" v-slot="{ navigate, href, isActive, isExactActive }" :to="item.to" custom>
<a v-ripple :href="href" :class="cx('action', { isActive, isExactActive })" tabindex="-1" aria-hidden="true" @click="onItemActionClick($event, navigate)" v-bind="getPTOptions('action')">
<component v-if="templates.itemicon" :is="templates.itemicon" :item="item" :class="[cx('icon'), item.icon]" />
<span v-else-if="item.icon" :class="[cx('icon'), item.icon]" v-bind="getPTOptions('icon')" />
<span :class="cx('label')" v-bind="getPTOptions('label')">{{ label() }}</span>
</a>
</router-link>
<a v-else v-ripple :href="item.url" :class="cx('action')" :target="item.target" tabindex="-1" aria-hidden="true" v-bind="getPTOptions('action')">
<a v-ripple :href="item.url" :class="cx('action')" :target="item.target" tabindex="-1" aria-hidden="true" v-bind="getPTOptions('action')">
<component v-if="templates.itemicon" :is="templates.itemicon" :item="item" :class="[cx('icon'), item.icon]" />
<span v-else-if="item.icon" :class="[cx('icon'), item.icon]" v-bind="getPTOptions('icon')" />
<span :class="cx('label')" v-bind="getPTOptions('label')">{{ label() }}</span>
@ -46,7 +39,7 @@ export default {
props: {
item: null,
templates: null,
exact: null,
id: null,
focusedOptionId: null,
index: null
@ -68,9 +61,6 @@ export default {
isItemFocused() {
return this.focusedOptionId === this.id;
},
onItemActionClick(event, navigate) {
navigate && navigate(event);
},
onItemClick(event) {
const command = this.getItemProp(this.item, 'command');