2018-04-19 03:10:01 +00:00
|
|
|
<template>
|
|
|
|
<div class="container">
|
2018-04-19 03:26:36 +00:00
|
|
|
<app-header :quoteCount="quotes.length" :maxQuotes="maxQuotes"></app-header>
|
2018-04-19 03:10:01 +00:00
|
|
|
<app-new-quote @newQuote="newQuote"></app-new-quote>
|
|
|
|
<hr>
|
2018-04-19 03:26:36 +00:00
|
|
|
<app-quote-grid :quotes="quotes" @quoteDelete="deleteQuote"></app-quote-grid>
|
2018-04-19 03:10:01 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12 text-center">
|
|
|
|
<div class="alert alert-info">click a quote to delete it.</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import QuoteGrid from './components/QuoteGrid.vue'
|
|
|
|
import NewQuote from './components/NewQuote.vue'
|
2018-04-19 03:26:36 +00:00
|
|
|
import Header from './components/Header.vue'
|
|
|
|
|
2018-04-19 03:10:01 +00:00
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
maxQuotes: 10,
|
|
|
|
quotes: ["Just a quote to see something"],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
appQuoteGrid: QuoteGrid,
|
2018-04-19 03:26:36 +00:00
|
|
|
appHeader: Header,
|
2018-04-19 03:10:01 +00:00
|
|
|
appNewQuote: NewQuote,
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
newQuote(quote) {
|
2018-04-19 03:26:36 +00:00
|
|
|
if (this.quotes.length >= this.maxQuotes){
|
|
|
|
return alert('Please delete quotes first');
|
|
|
|
}
|
2018-04-19 03:10:01 +00:00
|
|
|
this.quotes.push(quote)
|
|
|
|
},
|
2018-04-19 03:26:36 +00:00
|
|
|
deleteQuote(index){
|
|
|
|
this.quotes.splice(index, 1)
|
|
|
|
}
|
2018-04-19 03:10:01 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|