Skip to content

Commit 1e6decc

Browse files
Added an ActionBar to the 'router' demo
1 parent 3a1f35f commit 1e6decc

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

samples/app/app-with-list-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Vue = require('nativescript-vue/dist/index')
1+
const Vue = require('../dist/index')
22
const http = require('http')
33
const Page = require('ui/page').Page
44
const StackLayout = require('ui/layouts/stack-layout').StackLayout

samples/app/app-with-router.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,29 @@ router.replace('/foo')
5757
new Vue({
5858
router,
5959

60+
data: {
61+
pageTitle: 'Current route: /foo'
62+
},
63+
6064
template: `
61-
<page>
65+
<page ref="page">
66+
<action-bar :title="pageTitle"></action-bar>
6267
<stack-layout>
63-
<stack-layout orientation="horizontal">
64-
<button @tap="$router.replace('/foo')">Foo</button>
65-
<button @tap="$router.replace('/bar')">Bar</button>
68+
<stack-layout orientation="horizontal" horizontalAlignment="center" class="m-b-20">
69+
<button @tap="changeRoute('/foo')" class="m-10">Foo</button>
70+
<button @tap="changeRoute('/bar')" class="m-10">Bar</button>
6671
</stack-layout>
6772
68-
<label style="text-align: center">Current route: {{ $route.fullPath }}</label>
69-
7073
<router-view></router-view>
7174
</stack-layout>
7275
</page>
7376
`,
77+
78+
methods: {
79+
changeRoute(to) {
80+
this.pageTitle = 'Current route: ' + to
81+
router.replace(to)
82+
}
83+
}
84+
7485
}).$start()

0 commit comments

Comments
 (0)