cristijora / vue-tabs

Simplified bootstrap tabs
https://cristijora.github.io/vue-tabs/#/
MIT License
251 stars 72 forks source link

Back Button to a specific Tab #36

Closed jpldev closed 6 years ago

jpldev commented 6 years ago

Hi, how can I program a Back Button that takes me back to a specific Active Tab?

I use vue-router, could it be with router-link?

cristijora commented 6 years ago

Hi there. For router based tabs, I really recommend writing them without a library/component. You could simply have a router view and a styled list with tabs. This can be very trivial to do especially when using some css library

<ul class="nav nav-tabs">
        <li class="nav-item">
            <router-link to="/page1" class="nav-link" href="#">Page1</router-link>
        </li>
        <li class="nav-item">
            <router-link to="/page2" class="nav-link" href="#">Page2</router-link>
        </li>
        <li class="nav-item">
            <router-link to="/page3" class="nav-link" href="#">Page3</router-link>
        </li>
    </ul>
    <transition name="fade" mode="out-in">
        <router-view></router-view>
    </transition>   

https://codesandbox.io/s/2x56qkrp70

jpldev commented 6 years ago

Thanks !!