Skip to content

Commit adbe5d1

Browse files
committed
feat: add optional navigateHistory prop to RouterView
1 parent 10053e9 commit adbe5d1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/router/basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default Blits.Component('Poster', {
9494
})
9595
```
9696

97-
Whenever you navigate to a new page, the URL hash will automatically be updated. Unless specified otherwise, navigating to a new page, will add that route to the history stack. The `back` input action is automatically wired up to navigate back down the history stack.
97+
Whenever you navigate to a new page, the URL hash will automatically be updated. Unless specified otherwise, navigating to a new page, will add that route to the history stack. The `back` input action is automatically wired up to navigate back down the history stack. (If you want to disable this automatic navigation, you can pass `navigateHistory="false"` as a prop to the RouterView.)
9898

9999
By default, every time you navigate to a new route, the application focus will be automatically passed to the newly loaded page. If you instead want to maintain the current focus (for example in a widget that sits above your RouterView), you can use `passFocus: false` as part of the router options.
100100

src/components/RouterView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export default () =>
5050
}
5151
},
5252
},
53+
props: [{ key: 'navigateHistory', default: true }],
5354
input: {
5455
back(e) {
55-
const navigating = Router.back.call(this)
56-
if (navigating === false) {
56+
if (!this.navigateHistory || !Router.back.call(this)) {
5757
this.parent.$focus(e)
5858
}
5959
},

0 commit comments

Comments
 (0)