diff --git a/src/Deck.vue b/src/Deck.vue index 4a9df9d..7ea77d5 100644 --- a/src/Deck.vue +++ b/src/Deck.vue @@ -15,17 +15,34 @@ props: ['cards'], components: {Hero}, + data() { + return { + selected: null, + } + }, + + watch: { + selected() { + this.$emit('input', this.selected); + } + }, + computed: { allCards() { return Object .keys(this.cards) .flatMap(cardType => this.cards[cardType].flatMap((card, index) => { - let cardWrapper = { + let cardWrapper = [{ type: cardType, - card: this.cards[cardType][index], - props: Hero.props, - }; - return Array(card.count || 1).fill(cardWrapper); + card: card, + }]; + if (card.back) { // TODO: a little hacky + cardWrapper.push({ + type: cardType + '-back', + card: card.back, + }); + } + return Array(card.count || 1).fill(cardWrapper).flat(); })); }, diff --git a/src/Editor.vue b/src/Editor.vue index 2a796f8..abadae6 100644 --- a/src/Editor.vue +++ b/src/Editor.vue @@ -42,10 +42,10 @@
diff --git a/src/template/hero/Hero.vue b/src/template/hero/Hero.vue index 5c47a5b..5c6468b 100644 --- a/src/template/hero/Hero.vue +++ b/src/template/hero/Hero.vue @@ -1,11 +1,36 @@