Active router refactor
parent
28bba62530
commit
f6b61f494f
|
@ -42,16 +42,16 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isActive(item) {
|
isActive(item) {
|
||||||
return this.activeRoute === item.to;
|
return this.activeRoute === item.to || this.activeRoute === item.to + '/' ;
|
||||||
},
|
},
|
||||||
getItemClass(item) {
|
getItemClass(item) {
|
||||||
return ['p-steps-item', item.class, {
|
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)
|
'p-disabled': this.isItemDisabled(item)
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
isItemDisabled(item) {
|
isItemDisabled(item) {
|
||||||
return (item.disabled || (this.readonly && this.activeRoute !== item.to));
|
return (item.disabled || (this.readonly && !this.isActive(item)));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -40,10 +40,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isActive(item) {
|
isActive(item) {
|
||||||
return this.activeRoute === item.to;
|
return this.activeRoute === item.to || this.activeRoute === item.to + '/' ;
|
||||||
},
|
},
|
||||||
getItemClass(item) {
|
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) {
|
getItemIcon(item) {
|
||||||
return ['p-menuitem-icon', item.icon];
|
return ['p-menuitem-icon', item.icon];
|
||||||
|
|
Loading…
Reference in New Issue