2021-10-01 14:40:07 +00:00
|
|
|
<template>
|
2021-10-15 18:45:41 +00:00
|
|
|
<div>
|
2021-10-15 21:07:41 +00:00
|
|
|
<!-- <CollectQuotesExplain /> -->
|
2021-11-27 20:10:09 +00:00
|
|
|
<AddNewQuote />
|
2021-10-29 20:13:38 +00:00
|
|
|
<QuoteListItem v-for="quote in quotes" :key="quote.id" :quote="quote" />
|
2021-11-27 20:10:09 +00:00
|
|
|
<AddNewQuote v-if="quotes.length > 0"/>
|
2021-10-29 20:13:38 +00:00
|
|
|
<CollectQuote v-if="showCollectQuoteDialog" :quote="collectQuote" />
|
2021-10-01 14:40:07 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
2021-10-04 06:46:36 +00:00
|
|
|
export default {
|
2021-10-29 20:13:38 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showCollectQuoteDialog: false,
|
|
|
|
collectQuote: {},
|
|
|
|
}
|
|
|
|
},
|
2021-10-04 06:46:36 +00:00
|
|
|
computed: {
|
|
|
|
quotes() {
|
|
|
|
return this.$store.state.myQuotes.quotes
|
|
|
|
},
|
|
|
|
},
|
2021-10-29 20:13:38 +00:00
|
|
|
created() {
|
2021-11-22 06:08:54 +00:00
|
|
|
this.$nuxt.$on('close-quote', () => {
|
|
|
|
this.showCollectQuoteDialog = false
|
|
|
|
})
|
|
|
|
|
2021-10-29 20:13:38 +00:00
|
|
|
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
|
|
|
|
})
|
|
|
|
},
|
2021-10-04 06:46:36 +00:00
|
|
|
async fetch() {
|
|
|
|
await this.$engine.getMyQuotes()
|
|
|
|
},
|
2021-10-01 14:40:07 +00:00
|
|
|
}
|
|
|
|
</script>
|