Skip to content

Commit 2387968

Browse files
committed
feat (samples): Add a sample with a Vue component to check the HMR feature.
1 parent 1fe133b commit 2387968

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

samples/app/app-to-check-hmr.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const Vue = require('nativescript-vue')
2+
const application = require('tns-core-modules/application')
3+
const platform = require('tns-core-modules/platform')
4+
5+
Vue.config.silent = false
6+
Vue.config.debug = true
7+
8+
import Home from './components/Home'
9+
10+
new Vue({
11+
components: {
12+
Home
13+
},
14+
render: h => h('frame', [h(Home)])
15+
}).$start()

samples/app/components/Home.vue

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<template>
2+
<Page>
3+
<ActionBar class="action-bar" title="Home Page">
4+
</ActionBar>
5+
<StackLayout>
6+
<Button text="Open page" @tap="openPage" />
7+
</StackLayout>
8+
</Page>
9+
</template>
10+
11+
<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+
}
34+
35+
export default {
36+
components: [
37+
DetailsPage,
38+
],
39+
methods: {
40+
openPage() {
41+
this.$navigateTo(DetailsPage)
42+
}
43+
}
44+
}
45+
</script>

0 commit comments

Comments
 (0)