8000 Use `push` instead of `replace` so we can use the `back` functionality · saknarak/nativescript-vue@31badad · GitHub
[go: up one dir, main page]

Skip to content

Commit 31badad

Browse files
committed
Use push instead of replace so we can use the back functionality
1 parent 9ccc055 commit 31badad

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

samples/app/app-with-router-pages.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,32 @@ const Foo = {
99
<action-bar :title="$route.path"></action-bar>
1010
<stack-layout>
1111
<label style="text-align: center; color: #41b883; font-size: 30">Hi I'm foo!</label>
12-
<button @tap="$router.replace('/foo')">Foo</button>
13-
<button @tap="$router.replace('/bar')">Bar</button>
14-
<button @tap="$router.replace('/baz')">Baz</button>
12+
<button @tap="$router.push('/bar')">Bar</button>
13+
<button @tap="$router.push('/baz')">Baz</button>
1514
</stack-layout>
1615
</page>
1716
`
1817
}
1918
const Bar = {
2019
template: `
2120
<page>
22-
<action-bar :title="$route.path"></action-bar>
21+
<action-bar :title="$route.path">
22+
<navigation-button text="Back!" android.systemIcon="ic_menu_back" @tap="$router.back()"></navigation-button>
23+
</action-bar>
2324
<stack-layout>
2425
<label style="text-align: center; color: #41b883; font-size: 30">Hi I'm bar!</label>
25-
<button @tap="$rout 8000 er.replace('/foo')">Foo</button>
26-
<button @tap="$router.replace('/bar')">Bar</button>
27-
<button @tap="$router.replace('/baz')">Baz</button>
2826
</stack-layout>
2927
</page>
3028
`
3129
}
3230
const Baz = {
3331
template: `
3432
<page>
35-
<action-bar :title="$route.path"></action-bar>
33+
<action-bar :title="$route.path">
34+
<navigation-button text="Back!" android.systemIcon="ic_menu_back" @tap="$router.back()"></navigation-button>
35+
</action-bar>
3636
<stack-layout>
3737
<label style="text-align: center; color: #41b883; font-size: 30">Hi I'm baz!</label>
38-
<button @tap="$router.replace('/foo')">Foo</button>
39-
<button @tap="$router.replace('/bar')">Bar</button>
40-
<button @tap="$router.replace('/baz')">Baz</button>
4138
</stack-layout>
4239
</page>
4340
`
@@ -52,7 +49,7 @@ const router = new VueRouter({
5249
]
5350
})
5451

55-
router.replace('/foo')
52+
router.push('/foo')
5653

5754
new Vue({
5855
router,

0 commit comments

Comments
 (0)
0