Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Show active tab in TabMenu with different Route-Defintion #1051

Closed
CurrentlyNoName opened this issue Mar 4, 2021 · 3 comments
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add

Comments

@CurrentlyNoName
Copy link

Hello,

using TabMenu it's possible to define one Tab-Item like this:

{label: 'Home', icon: 'pi pi-fw pi-home', to: '/tabmenu'},

When using it that way, the active tab-item is shown correctly.

Yet, we use route with "to" like this:

to: { name: 'LocatorSubView'}

The route will be opened, but not be shown as active, because the "activeRoute" in TabMenu is defined with

activeRoute() {
    return this.$route.path;
}

and the path is not what's written in our to-property, which is why the comparison fails:

return this.activeRoute === item.to;

Is it possible for route-definitions like ours to also be shown as activated?

@CurrentlyNoName
Copy link
Author

I checked the the TabMenu-Component and was able to achieve with the following changes:

  1. Change the computed "activeRoute" to:
activeRoute() {
   return this.$route;
},
  1. Change the "isActive"-Function to:
isActive(item) {
	if (this.activeRoute.path === item.to) {
		return true;
	}

	if (this.activeRoute.name === item.to.name) {
		return true;
	}

	return false;
},

I don't know if there are other combinations for valid-route-definitions, though.

@cagataycivici cagataycivici self-assigned this Mar 10, 2021
@cagataycivici cagataycivici added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Mar 10, 2021
@cagataycivici cagataycivici modified the milestone: 3.3.5 Mar 10, 2021
@cagataycivici cagataycivici removed their assignment Mar 10, 2021
@m-thorsen
Copy link

m-thorsen commented Mar 19, 2021

I find myself often using a Tab menu to switch between "dynamic versions" of the same page where it would be quite messy to add new routes for each possibility - so I have a request related to this enhancement:

  • Option for including query and/or hash in the active state check

I guess this could be accomplished by checking $route.fullPath instead of $route.path?

@cagataycivici cagataycivici self-assigned this May 11, 2021
@cagataycivici cagataycivici added this to the 3.5.0 milestone May 11, 2021
@cagataycivici
Copy link
Member

Covered via;

#594

@cagataycivici cagataycivici removed their assignment May 14, 2021
@cagataycivici cagataycivici removed this from the 3.5.0 milestone May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

3 participants