Skip to content

Commit

Permalink
Refactor BookList component
Browse files Browse the repository at this point in the history
carolinapowers committed Sep 17, 2018
1 parent 75d6009 commit e7962cd
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/components/BookList.vue
Original file line number Diff line number Diff line change
@@ -2,48 +2,45 @@
<div>
<h1>{{title}}</h1>
<ul>
<book-item
v-for='book in books'
:key='book.id'
:book='book'
>{{book.title}}:{{book.author}}</book-item>
<book-item v-for='book in books' :key='book.id' :book='book'>{{book.title}}:{{book.author}}</book-item>
</ul>
<br><hr>
<book-form @addBook='appendBook'></book-form>
</div>
</template>

<script>
import BookItem from './BookItem';
import BookForm from './BookForm';
import BookItem from "./BookItem";
import BookForm from "./BookForm";
export default {
name: 'BookList',
name: "BookList",
data() {
return {
title: 'All Books',
states: ['Want to Read', 'Read', 'Reading'],
title: "All Books",
states: ["Want to Read", "Read", "Reading"],
books: [
{ title: 'Self-Reliance', author: 'Ralph Waldo Emerson' },
{ title: 'American Gods', author: 'Neil Gaiman' },
{ title: 'Amusing Ourselves to Death', author: 'Neil Postman' },
],
{ title: "Self-Reliance", author: "Ralph Waldo Emerson" },
{ title: "American Gods", author: "Neil Gaiman" },
{ title: "Amusing Ourselves to Death", author: "Neil Postman" }
]
};
},
components: {
BookItem,
BookForm,
BookForm
},
methods: {
appendBook(bookTitle, bookAuthor) {
this.books.push({ title: bookTitle, author: bookAuthor });
},
},
}
}
};
</script>

<style>
h1, h2 {
h1,
h2 {
font-weight: normal;
}
ul {

0 comments on commit e7962cd

Please sign in to comment.