"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:
pskfyi 2022-01-06 14:28:23 -08:00 committed by pskfyi
commit 225d7e3c09
5 changed files with 94 additions and 32 deletions

View file

@ -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>