Skip to content

Commit

Permalink
lesson-14
Browse files Browse the repository at this point in the history
  • Loading branch information
iamshaunjp committed Sep 22, 2020
1 parent e30e48c commit e9d95dd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
7 changes: 3 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const app = Vue.createApp({
data() {
return {
url: 'https://www.thenetninja.co.uk',
showBooks: true,
books: [
{ title: 'name of the wind', author: 'patrick rothfuss', img: 'assets/1.jpg' },
{ title: 'the way of kings', author: 'brandon sanderson', img: 'assets/2.jpg' },
{ title: 'the final empire', author: 'brandon sanderson', img: 'assets/3.jpg' },
{ title: 'name of the wind', author: 'patrick rothfuss', img: 'assets/1.jpg', isFav: true },
{ title: 'the way of kings', author: 'brandon sanderson', img: 'assets/2.jpg', isFav: false },
{ title: 'the final empire', author: 'brandon sanderson', img: 'assets/3.jpg', isFav: true },
],
}
},
Expand Down
35 changes: 23 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,38 @@
<title>Learning Vue</title>
<script src="https://unpkg.com/[email protected]"></script>
<style>
.box {
padding: 100px 0;
width: 400px;
text-align: center;
background: #ddd;
margin: 20px;
display: inline-block;
body{
background: #eee;
max-width: 960px;
margin: 20px auto;
}
p, h3, ul{
margin: 0;
padding: 0;
}
li{
list-style-type: none;
background: #fff;
margin: 20px auto;
padding: 10px 20px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: space-between;
}
li.fav{
background: #ff9ed2;
color: white;
}
</style>
</head>
<body>
<h1>Hello, Vue :)</h1>

<div id="app">
<!-- attribute binding -->
<!-- <a v-bind:href="url">Best website ever!</a> -->
<a :href="url">Best website ever!</a>

<div v-if="showBooks">
<ul>
<li v-for="book in books">
<li v-for="book in books" :class="{ fav: book.isFav }">
<img :src="book.img" :alt="book.title">
<h3>{{ book.title }}</h3>
<p>{{ book.author }}</p>
Expand Down

1 comment on commit e9d95dd

@Brooks990
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello ,sir you using you event on Vs code is not working it only diplay the content but no action ,kindly i need you help

Please sign in to comment.