scrimba
The Vue Bootcamp
Capstone project
Final Project Part 7
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Final Project Part 7
AboutCommentsNotes
Final Project Part 7
Expand for more info
pages
transactions
index.vue
run
preview
console
<template>
<div class="flex flex-col items-center">
<h1>My Transactions</h1>

<div v-for="(transaction, index) in getTransactions" class="transaction">
<div class="flex">
<div class="w-20">
<plus-sign v-if="transaction.type === 'credit'" class="text-green-500"></plus-sign>
<minus-sign v-else class="text-red-600"></minus-sign>
</div>
<div>{{ transaction.description.substring(0, 20) }}</div>
</div>
<div class="flex">
<div class="mr-4">{{ formatMoney(transaction.amount) }}</div>
<div>
<button @click.prevent="removeTransaction(index)">X</button>
</div>
</div>
</div>
</div>
</template>

<script>
const mapGetters = require('vuex')['mapGetters'];
const PlusSign = require('../../components/ui/PlusSign');
const MinusSign = require('../../components/ui/MinusSign');

module.exports = {
components: {
PlusSign,
MinusSign
},
computed: {
...mapGetters([
'getTransactions'
])
},
methods: {
removeTransaction: function (index) {
this.$store.dispatch('showModal')
.then(() => {
this.$store.dispatch('removeTransaction', index);
});
}
}
}
</script>
Console
"Download the Vue Devtools extension for a better development experience: https://github.com/vuejs/vue-devtools"
,
"You are running Vue in development mode. Make sure to turn on production mode when deploying for production. See more tips at https://vuejs.org/guide/deployment.html"
,
/index.html#/transactions
-5:42