-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
42 lines (42 loc) · 1.11 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const app = Vue.createApp({
data(){
return {
url: 'http://www.eldadservices.com',
showBooks:true,
books: [
{title:'La fin des àges',author:'Pearson',img:'assets/1.jpg', isFav: true},
{title:'La matière ',author:'Carls',img:'assets/2.jpg', isFav: false},
{title:'Empire Lunda',author:'Le Muntu',img:'assets/3.jpg', isFav: true},
],
x: 0,
y: 0
}
},
methods: {
changeTitle(title){
this.title = title;
},
toggleShowBooks(){
this.showBooks = !this.showBooks;
},
handleEvent(e, data){
console.log(e, e.type);
if(data){
console.log(data);
}
},
handleMouseMove(e){
this.x = e.offsetX;
this.y = e.offsetY;
},
changeFav(book){
book.isFav = !book.isFav;
}
},
computed: {
filteredBooks(){
return this.books.filter((book) => book.isFav);
}
}
})
app.mount('#app')