57 lines
1.2 KiB
Vue
57 lines
1.2 KiB
Vue
<template>
|
|
<div>
|
|
<!-- <CollectQuotesExplain /> -->
|
|
<AddNewQuote />
|
|
<QuoteListItem v-for="quote in quotes" :key="quote.id" :quote="quote" />
|
|
<AddNewQuote v-if="quotes.length > 0"/>
|
|
<CollectQuote v-if="showCollectQuoteDialog" :quote="collectQuote" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
showCollectQuoteDialog: false,
|
|
collectQuote: {},
|
|
}
|
|
},
|
|
computed: {
|
|
quotes() {
|
|
return this.$store.state.myQuotes.quotes
|
|
},
|
|
},
|
|
created() {
|
|
this.$nuxt.$on('close-quote', () => {
|
|
this.showCollectQuoteDialog = false
|
|
})
|
|
|
|
this.$nuxt.$on('edit-quote', (quote) => {
|
|
this.showCollectQuoteDialog = true
|
|
this.collectQuote = {
|
|
id: quote.id,
|
|
quote: quote.quote,
|
|
}
|
|
})
|
|
|
|
this.$nuxt.$on('create-quote', (quote) => {
|
|
this.showCollectQuoteDialog = true
|
|
this.collectQuote = {
|
|
id: ':new:',
|
|
quote: '',
|
|
}
|
|
})
|
|
|
|
this.$nuxt.$on('save-quote', async (quote) => {
|
|
this.$engine.saveQuote(quote.id, quote.quote)
|
|
await this.$engine.getMyQuotes()
|
|
this.showCollectQuoteDialog = false
|
|
})
|
|
},
|
|
async fetch() {
|
|
await this.$engine.getMyQuotes()
|
|
},
|
|
}
|
|
</script>
|