Advertisement
jwetoszka

App.vue

May 6th, 2022
1,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.69 KB | None | 0 0
  1. <template>
  2.   <NewBook @custom-event-name="addBook" />
  3.   <BookList :books="books" />
  4. </template>
  5.  
  6. <script>
  7. import NewBook from "./components/NewBook.vue";
  8. import BookList from "./components/BookList.vue";
  9.  
  10. export default {
  11.   name: "App",
  12.   components: {
  13.     NewBook,
  14.     BookList,
  15.   },
  16.   data() {
  17.     return {
  18.       books: [
  19.         { title: "Ogniem i mieczem", author: "Henryk Sienkiewicz", pages: 250 },
  20.         { title: "Potop", author: "Henryk Sienkiewicz", pages: 421 },
  21.         { title: "Black Out", author: "Marc Elsberg", pages: 384 }
  22.  
  23.       ],
  24.     };
  25.   },
  26.  
  27.   methods: {
  28.     addBook(book) {
  29.        this.books.push(book)
  30.     },
  31.   },
  32. };
  33. </script>
  34.  
  35.  
  36. <style>
  37. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement