vue-nav
The library is a navigation manager, it is similar to native mobile app.
require vue 2.x and vue-router 2.x.
Function
- support cache last view
- A forward to B,then forward to C, navigation stack have A, B, C;
- C back to B,C pop from navigation stack and destroyed, B will recover from cache, navigation stack have A, B;
- B back to A,B pop from navigation stack and destroyed, A will recover from cache, navigation stack have A;
- A forward to B again,B will rebuild, not recover from cache, navigation stack have A, B.
- support mutiple instances of same page
- A forward to B,then forward to A, navigation stack have A, B, A. Two A are different instance, they can have different state;
- A back to B,B will recover from cache, navigation stack have A, B;
- B back to A,A will recover from cache, navigation stack have A;
- support single task like android app, see Use Single Page
- A forward to B,then forward to C, A is single, navigation stack have A, B, C
- C forward to A, C and B is destroyed, and removed from navigation stack, navigation stack only have A
- A can't back to C
- support lifecycle activated and deactivated
- A forward to B, B is activated
- B back to A, A is activated, B is deactivated and then B is destroyed
- support router.replace
- current page is A, then call router.replace forward to B, navigation stack will only have B
- you can use router.replace when app login to prevent user come back to login page, like this.$router.replace('/main')
- support router.clearPush
- A forward to B, navigation stack have A, B
- then call router.clearPush forward to C, navigation stack will only have C
- you can use clearPush when app logout and jump to login page, like this.$router.clearPush('/login')
Attention
This Plugin just manage the page instance of navigation stack, it will not change the history of browser. So browser history is just as like as vue-router
Install
Usage
main.js
App.vue
Use Single Page
Use with vuex2
main.js
App.vue
You can use stack.direction to control transition. stack.direction is mapped from vuex state