-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCounter.vue
36 lines (32 loc) · 971 Bytes
/
Counter.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<template>
<Page class="page">
<ActionBar class="action-bar" title="Counter">
<NavigationButton text="Go Back" android.systemIcon="ic_menu_back" @tap="$router.push('/home')"/>
</ActionBar>
<StackLayout>
<FlexboxLayout flexDirection="row" justifyContent="center">
<Button @tap="decrement" text="-" class="btn btn-outline"/>
<Label :text="message" alignSelf="baseline" class="h2"/>
<Button @tap="increment" text="+" class="btn btn-outline"/>
</FlexboxLayout>
<Image v-if="surprise" src="~/images/NativeScript-Vue.png"/>
</StackLayout>
</Page>
</template>
<script>
import { mapActions } from 'vuex';
export default {
computed: {
message () {
return this.$store.state.counter.count.toString();
},
surprise () {
return (this.$store.state.counter.count >= 5);
},
},
methods: mapActions([
'decrement',
'increment',
]),
};
</script>