gamebrary/src/components/Game/GameNotes.vue

38 lines
662 B
Vue
Raw Normal View History

2020-08-22 12:21:15 +00:00
<template lang="html">
2020-11-03 22:49:30 +00:00
<b-alert
v-if="notes[game.id]"
2020-09-24 04:15:31 +00:00
variant="warning"
2020-11-03 22:49:30 +00:00
show
v-b-modal.notes
2021-02-16 23:21:39 +00:00
class="mt-2 mt-md-0"
2020-11-03 22:49:30 +00:00
>
2021-02-16 23:57:29 +00:00
<strong>Notes:</strong>
2020-11-03 22:49:30 +00:00
<vue-markdown :source="gameNotes" />
</b-alert>
2020-08-22 12:21:15 +00:00
</template>
<script>
2020-11-03 22:49:30 +00:00
import { mapState } from 'vuex';
import VueMarkdown from 'vue-markdown';
2020-08-22 12:21:15 +00:00
export default {
2020-11-03 22:49:30 +00:00
components: {
VueMarkdown,
2020-08-22 12:21:15 +00:00
},
2020-11-03 22:49:30 +00:00
props: {
game: Object,
2020-08-22 12:21:15 +00:00
},
computed: {
...mapState(['notes']),
2020-11-03 22:49:30 +00:00
gameNotes() {
return typeof this.notes[this.game.id] === 'object' && this.notes[this.game.id].text
? this.notes[this.game.id].text
: this.notes[this.game.id];
2020-08-22 12:21:15 +00:00
},
},
};
</script>