Fixed #1310 - Programmatic PanelMenu header link needs click twice to toggle itself

pull/1317/head
Tuğçe Küçükoğlu 2021-06-01 12:26:15 +03:00
parent 52e5585887
commit 1f23736c2b
2 changed files with 9 additions and 1 deletions

View File

@ -57,6 +57,10 @@ export default {
},
methods: {
onItemClick(event, item, navigate) {
if (this.isActive(item) && this.activeItem === null) {
this.activeItem = item;
}
if (item.disabled) {
event.preventDefault();
return;
@ -97,7 +101,7 @@ export default {
return ['p-panelmenu-panel', item.class];
},
getPanelToggleIcon(item) {
const active = item === this.activeItem;
const active = this.isActive(item) && this.activeItem === null ? true : item === this.activeItem;
return ['p-panelmenu-icon pi', {'pi-chevron-right': !active,' pi-chevron-down': active}];
},
getPanelIcon(item) {

View File

@ -54,6 +54,10 @@ export default {
},
methods: {
onItemClick(event, item, navigate) {
if (this.isActive(item) && this.activeItem === null) {
this.activeItem = item;
}
if (item.disabled) {
event.preventDefault();
return;