Active router refactor

pull/132/head
cagataycivici 2019-12-30 12:57:22 +03:00
parent 28bba62530
commit f6b61f494f
2 changed files with 8 additions and 5 deletions

View File

@ -42,16 +42,16 @@ export default {
}
},
isActive(item) {
return this.activeRoute === item.to;
return this.activeRoute === item.to || this.activeRoute === item.to + '/' ;
},
getItemClass(item) {
return ['p-steps-item', item.class, {
'p-highlight p-steps-current': (this.activeRoute === item.to),
'p-highlight p-steps-current': this.isActive(item),
'p-disabled': this.isItemDisabled(item)
}];
},
isItemDisabled(item) {
return (item.disabled || (this.readonly && this.activeRoute !== item.to));
return (item.disabled || (this.readonly && !this.isActive(item)));
}
},
computed: {

View File

@ -40,10 +40,13 @@ export default {
}
},
isActive(item) {
return this.activeRoute === item.to;
return this.activeRoute === item.to || this.activeRoute === item.to + '/' ;
},
getItemClass(item) {
return ['p-tabmenuitem', item.class, {'p-highlight': this.activeRoute === item.to, 'p-disabled': item.disabled}];
return ['p-tabmenuitem', item.class, {
'p-highlight': this.isActive(item),
'p-disabled': item.disabled
}];
},
getItemIcon(item) {
return ['p-menuitem-icon', item.icon];