Skip to content

Commit 35ec510

Browse files
committed
1 parent 0fdf81d commit 35ec510

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

samples/app/220.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const Vue = require('./nativescript-vue')
2+
3+
Vue.config.debug = true
4+
Vue.config.silent = false
5+
6+
const CompButton = {
7+
template: `
8+
<Button @tap="counter++">{{label}}: {{counter}}</Button>
9+
`,
10+
name: 'CompButton',
11+
props: ['label'],
12+
data() {
13+
return {
14+
counter: 0
15+
}
16+
}
17+
}
18+
19+
new Vue({
20+
data: {
21+
counter: 0
22+
},
23+
template: `
24+
<Frame>
25+
<Page>
26+
<ActionBar title="Issue #127" />
27+
28+
<StackLayout>
29+
<Button @tap="counter++">{{counter}}</Button>
30+
31+
<keep-alive>
32+
<CompButton v-if="counter % 2" key="odd" label="Odd"></CompButton>
33+
<CompButton v-else key="even" label="Even"></CompButton>
34+
</keep-alive>
35+
</StackLayout>
36+
</Page>
37+
</Frame>
38+
`,
39+
created() {
40+
console.log(Vue.compile(this.$options.template).render.toString())
41+
},
42+
components: {
43+
CompButton
44+
}
45+
}).$start()

0 commit comments

Comments
 (0)