spatie / vue-tabs-component

An easy way to display tabs with Vue

Home Page:http://vue-tabs-component.spatie.be

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

changed event fires twice on each change

ryan-lang opened this issue · comments

I'm running into a small issue with the "changed" event: every time a tab is changed, the event is emitted twice.

This seems to happen because selectTab() is actually called twice. It happens once directly via the click handler, and a second time due to the hashchange event listener.

It seems to me that we'd want to either let the click event handler initiate the change, OR the hashchange event handler, but not both. Also, I found at least one way to set the hash without triggering the hashchange event, which could be another approach.

I'm happy to put in the work with this, but I wanted to touch base first before offering a PR. I may be missing something here...

Very helpful component - thank you!

Calling selectTab twice doesn't sound like the way we want this to behave! We'd accept a PR that fixe this.