Reseting all tab views to main page

I have an app with Tabs. Each tab view has a number of stacked pages. Users will browse stacked pages on each tab. Is there anyway to reset all tab views to show the ‘main’ page in each tab view? So if the user leaves the app and comes back at a later time, I would like to show the main page in each of the tab views.

Thanks

You should call .router.back(url, { force: true }) on every View, where url is matching url for first/main route

Thanks. I don’t have a specified ‘url’ for the first page of the view. Here’s an example:

<div id=“view-discover” class=“view tab”>
<div data-name=“discover” class=“page no-navbar”>

Can I specify a page name instead of a url?

Thanks

How are you specifying your routes?

I specify routes when creating the app but I don’t specify a route for the main page of each tab. So basically I have tabs, each having its own view, when user clicks on the button, it shows the appropriate tab view (no routes are needed) and then within a view, the user can navigate a bunch of pages configured in the routes[] configuration.

Can anyone help with this? Basically assume the following:



  <!-- Catalog View -->
  <div id="view-catalog" class="view tab">
    <div data-name="page1" class="page"></div>
    <div data-name="page2" class="page"></div>
    <div data-name="page3" class="page"></div>
  </div>

If a user navigates to page3 by click on a link from page1-> page2->page3, how can I reset the view so that it loads page1 - cannot call router.back(url, { force: true })` as I don’t have any url specified.

Покажите код, в котором routes

I have no routes specified.

Без routes не будет работать навигация по страницам.

For anyone looking for a solution:

if (v.history.length > 1)
v.router.back(v.history[0], {
force : true
});

(where ‘v’ is your view)

2 Likes