This commit is contained in:
sschum 2023-07-13 14:54:56 +02:00
parent 42db27c5d0
commit d8a4bd6af4

View File

@ -16,6 +16,10 @@
<p class="card-text">
<input type="text" v-model="message" />
</p>
<p>
Cards: {{ cards.length }}
Charcounter: {{ amountOfChars }}
</p>
<a href="#" class="btn btn-primary" v-on:click="addCard">Add Card</a>
</div>
@ -40,6 +44,13 @@
cards: [],
}
},
computed: {
amountOfChars() {
if(this.cards.length === 0) return 0
return this.cards.map(c => c.content.length).reduce((pv, cv) => pv + cv)
},
},
methods: {
addCard() {
this.cards.push({