mirror of
https://github.com/sschum/froscon-2023-demo.git
synced 2024-11-25 01:03:19 +01:00
update
This commit is contained in:
parent
3ba0e71d12
commit
7c8b5bf83f
@ -6,6 +6,7 @@
|
||||
|
||||
<link href="./css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="./js/vue.js"></script>
|
||||
<script src="./js/vuex.js"></script>
|
||||
<script src="./js/vue-router.js"></script>
|
||||
|
||||
<!-- "page components" -->
|
||||
@ -25,20 +26,42 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Store-Counter: {{ storeCount }}</p>
|
||||
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const store = Vuex.createStore({
|
||||
state(){
|
||||
return {
|
||||
count: 0
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
increment (state) {
|
||||
state.count++
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const router = VueRouter.createRouter({
|
||||
history: VueRouter.createWebHashHistory(),
|
||||
routes: [
|
||||
{ path: "/hello", component: pages['hello'] },
|
||||
{ path: "/age", component: pages['age'] },
|
||||
]
|
||||
],
|
||||
})
|
||||
|
||||
const MyVueApp = Vue.createApp({})
|
||||
const MyVueApp = Vue.createApp({
|
||||
computed: {
|
||||
storeCount(){
|
||||
return this.$store.state.count
|
||||
}
|
||||
}
|
||||
})
|
||||
MyVueApp.use(router)
|
||||
MyVueApp.use(store)
|
||||
</script>
|
||||
<script src="./js/card.js"></script>
|
||||
<script>
|
||||
|
@ -39,4 +39,9 @@ pages['age'] = {
|
||||
return this.hours / 24
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
days(){
|
||||
this.$store.commit('increment')
|
||||
}
|
||||
}
|
||||
}
|
@ -45,12 +45,16 @@ pages['hello'] = {
|
||||
},
|
||||
methods: {
|
||||
addCard() {
|
||||
this.$store.commit('increment')
|
||||
|
||||
this.cards.push({
|
||||
id: new Date().getTime(),
|
||||
content: this.message,
|
||||
})
|
||||
},
|
||||
removeCard(i) {
|
||||
this.$store.commit('increment')
|
||||
|
||||
this.cards.splice(i, 1)
|
||||
}
|
||||
},
|
||||
|
1514
src/js/vuex.js
Normal file
1514
src/js/vuex.js
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user