Guest User

Untitled

a guest
Jun 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Belajar Vue</title>
  5. <script src="lib/vue.js"></script>
  6. <style>
  7. form {
  8. border: 1px solid #ddd;
  9. padding:5px;
  10. width:225px;
  11. background: #efefef;
  12. }
  13. label{
  14. display: block;
  15. margin-top: 5px;
  16. }
  17.  
  18. input, textarea, select, option {
  19. min-width: 200px;
  20. }
  21.  
  22. button1{
  23. width:50px;
  24. font-size: 125%;
  25. }
  26.  
  27. .card {
  28. background: #efefef;
  29. border:1px solid #ddd;
  30. margin-right:5px;
  31. padding:5px;
  32. width: 200px;
  33. float:left;
  34. }
  35.  
  36. h3{
  37. min-height: 45px;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42.  
  43. <div id="app">
  44. <h1>Selected: {{ selectedBook }}</h1>
  45. <book
  46. v-for="book in books"
  47. :key="book.id"
  48. :book="book"
  49. @selected="selectedBook = $event"
  50. >
  51. </book>
  52. </div>
  53.  
  54. <script type="module">
  55.  
  56. import { BookComponent } from './BookComponent.js'
  57.  
  58. var vm = new Vue({
  59. el: '#app',
  60. components: {
  61. 'book': BookComponent,
  62. },
  63. data: {
  64. selectedBook: '',
  65. books : [
  66. {
  67. id: 99,
  68. title: 'C++ High Performance',
  69. description: 'Write code that scales across CPU registers, multi-core, and machine clusters',
  70. authors: 'Viktor Sehr, Björn Andrist',
  71. publish_year: 2018,
  72. price: 100000,
  73. image: 'c++-high-performance.png'
  74. },
  75. {
  76. id: 100,
  77. title: 'Mastering Linux Security and Hardening',
  78. description: 'A comprehensive guide to mastering the art of preventing your Linux system from getting compromised',
  79. authors: 'Donald A. Tevault',
  80. publish_year: 2018,
  81. price: 125000,
  82. image: 'mastering-linux-security-and-hardening.png'
  83. },
  84. ]
  85. }
  86. })
  87. </script>
  88. </body>
  89. </html>
Add Comment
Please, Sign In to add comment