mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 09:22:34 +00:00
Refactor #4739 - For PanelMenu
This commit is contained in:
parent
f00540f4ab
commit
c1c866b23b
6 changed files with 5 additions and 56 deletions
|
@ -19,14 +19,7 @@
|
|||
>
|
||||
<div :class="cx('headerContent')" v-bind="getPTOptions('headerContent', item, index)">
|
||||
<template v-if="!$slots.item">
|
||||
<router-link v-if="getItemProp(item, 'to') && !isItemDisabled(item)" v-slot="{ navigate, href, isActive, isExactActive }" :to="getItemProp(item, 'to')" custom>
|
||||
<a :href="href" :class="cx('headerAction', { isActive, isExactActive })" :tabindex="-1" @click="onHeaderActionClick($event, navigate)" v-bind="getPTOptions('headerAction', item, index)">
|
||||
<component v-if="$slots.headericon" :is="$slots.headericon" :item="item" :class="[cx('headerIcon'), getItemProp(item, 'icon')]" />
|
||||
<span v-else-if="getItemProp(item, 'icon')" :class="[cx('headerIcon'), getItemProp(item, 'icon')]" v-bind="getPTOptions('headerIcon', item, index)" />
|
||||
<span :class="cx('headerLabel')" v-bind="getPTOptions('headerLabel', item, index)">{{ getItemLabel(item) }}</span>
|
||||
</a>
|
||||
</router-link>
|
||||
<a v-else :href="getItemProp(item, 'url')" :class="cx('headerAction')" :tabindex="-1" v-bind="getPTOptions('headerAction', item, index)">
|
||||
<a :href="getItemProp(item, 'url')" :class="cx('headerAction')" :tabindex="-1" v-bind="getPTOptions('headerAction', item, index)">
|
||||
<slot v-if="getItemProp(item, 'items')" name="submenuicon" :active="isItemActive(item)">
|
||||
<component :is="isItemActive(item) ? 'ChevronDownIcon' : 'ChevronRightIcon'" :class="cx('submenuIcon')" v-bind="getPTOptions('submenuIcon', item, index)" />
|
||||
</slot>
|
||||
|
@ -48,7 +41,6 @@
|
|||
:expandedKeys="expandedKeys"
|
||||
@item-toggle="changeExpandedKeys"
|
||||
@header-focus="updateFocusedHeader"
|
||||
:exact="exact"
|
||||
:pt="pt"
|
||||
:unstyled="unstyled"
|
||||
/>
|
||||
|
@ -83,11 +75,6 @@ export default {
|
|||
this.id = newValue || UniqueComponentId();
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
if (!this.$slots.item) {
|
||||
console.warn('In future versions, vue-router support will be removed. Item templating should be used.');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.id = this.id || UniqueComponentId();
|
||||
},
|
||||
|
@ -200,9 +187,6 @@ export default {
|
|||
headerAction ? headerAction.click() : this.onHeaderClick(event, item);
|
||||
event.preventDefault();
|
||||
},
|
||||
onHeaderActionClick(event, navigate) {
|
||||
navigate && navigate(event);
|
||||
},
|
||||
findNextHeader(panelElement, selfCheck = false) {
|
||||
const nextPanelElement = selfCheck ? panelElement : panelElement.nextElementSibling;
|
||||
const headerElement = DomHandler.findSingle(nextPanelElement, '[data-pc-section="header"]');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue