"incremental.js" vuex store for shared state. See InfinityTester component for examples on how to modify the store; arbitarily many currencies can be controlled.
This commit is contained in:
parent
cc65639b75
commit
225d7e3c09
5 changed files with 94 additions and 32 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<template>
|
||||
<div class="bg-white grid place-content-center border-2 w-3/4 mx-auto">
|
||||
<div>Energy: {{ $store.state.incremental.currency.energy }}</div>
|
||||
<div>Time: {{ timecurrency }}</div>
|
||||
<nav class="flex flex-col sm:flex-row">
|
||||
<button
|
||||
id="tab1"
|
||||
|
|
@ -36,10 +38,15 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Decimal from "break_infinity.js"
|
||||
|
||||
export default {
|
||||
name: 'TabNav',
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
energycurrency: new Decimal(0),
|
||||
timecurrency: new Decimal(0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
tabclicked(tabnumber) {
|
||||
|
|
@ -60,6 +67,10 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
increaseCurrency (energy, time) {
|
||||
this.energycurrency = Decimal.add(this.energycurrency, energy)
|
||||
this.timecurrency = Decimal.add(this.timecurrency, time)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Reference in a new issue