Back event not work in V2

I want to use back event on V2 like V1

like

$$(document).on('page:back', function (e) {
    console.log(e);
});

There is no such event in v2, you can probably use “page:beforeout” and check the direction (from/to properties) in event.detail

It work, thank you sir.

Are you have know other events about page switch in V2? Share me please.

https://blog.framework7.io/mastering-v2-router-958ea2dbd24f

Hi, I have a view with several fields I want to update my database once I leave the page.
I’m using page:beforeout on this view to update my database.
The problem is that the fields are null.

$$("#travel_detail_name_day").val();

any ideas?

Whats type it’t element ('#travel_detail_name_day') ?

Please, send you html file.

<input type="text" placeholder="Título" id="travel_detail_name_day" class="">

this my html element

Try it add it in your router.js

pageAfterOut: function () {
           var valor = $$("#travel_detail_name_day").val();
           console.log(valor);
}

Sorry for my enligsh horrible. rsrs

More infos: https://blog.framework7.io/mastering-v2-router-958ea2dbd24f

Hi, thanks for the response. I will try it.

1 Like

Ok, I right… look ‘tis:

pageAfterOut: function (e,page) {
           console.log(page);
}
1 Like

It worked with event call inside the router file

1 Like

Poste example. Very Good! Nice job.