10000 feat (samples): Separate the details page into a new .vue component f… · uuuuuext/nativescript-vue@1f5c52a · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f5c52a

Browse files
committed
feat (samples): Separate the details page into a new .vue component for better UX
1 parent 924b99b commit 1f5c52a

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

samples/app/components/Details.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<Page>
3+
<ActionBar class="action-bar" title="Details Page">
4+
<ActionItem text="Action"></ActionItem>
5+
</ActionBar>
6+
<StackLayout>
7+
<Label :text="'Details ' + Math.random()" />
8+
<Button text="another" @tap="openDetails" />
9+
<Button text="back" @tap="goBack" />
10+
</StackLayout>
11+
</Page>
12< 8000 /code>+
</template>
13+
14+
<script>
15+
const page = {
16+
methods: {
17+
openDetails() {
18+
this.$navigateTo(page)
19+
}
20+
}
21+
}
22+
export default page;
23+
</script>

samples/app/components/Home.vue

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,15 @@
99
</template>
1010

1111
<script>
12-
const DetailsPage = {
13-
template: `
14-
<Page>
15-
<ActionBar class="action-bar" title="Details Page">
16-
<ActionItem text="Action"></ActionItem>
17-
</ActionBar>
18-
<StackLayout>
19-
<Label :text="'Details ' + Math.random()" />
20-
<Button text="another" @tap="openDetails" />
21-
<Button text="back" @tap="goBack" />
22-
</StackLayout>
23-
</Page>
24-
`,
25-
methods: {
26-
openDetails() {
27-
this.$navigateTo(DetailsPage)
28-
},
29-
goBack() {
30-
this.$navigateBack()
31-
}
32-
}
33-
}
12+
import Details from './Details'
3413
3514
export default {
3615
components: [
37-
DetailsPage,
16+
Details,
3817
],
3918
methods: {
4019
openPage() {
41-
this.$navigateTo(DetailsPage)
20+
this.$navigateTo(Details)
4221
}
4322
}
4423
}

samples/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"main": "app-with-shared-actionbar.js",
2+
"main": "app-to-check-hmr.js",
33
"name": "nativescript-template-tutorial",
44
"version": "1.0.1"
55
}

0 commit comments

Comments
 (0)
0