-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
82 lines (78 loc) · 2.37 KB
/
Copy pathapp.js
File metadata and controls
82 lines (78 loc) · 2.37 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
console.log("test");
const app = Vue.createApp({
data(){
return{
computer: [
{
id:1,
name: 'Lenovo',
description: 'Bra prestanda',
image: '/resources/products/item1.jpg',
price: '5999'
},
{
id: 2,
name: 'MacBook Air',
description: 'Datorn för studenten',
image: '/resources/products/item2.png',
price: '10999'
},
{
id: 3,
name: 'Acer',
description: 'Bra batteritid',
image: '/resources/products/item3.jpg',
price: '7999'
},
{
id: 4,
name: 'HP',
description: 'Kontor',
image: '/resources/products/item4.jpg',
price: '5999'
},
{
id:5,
name: 'MacBook Pro',
description: 'För den krävande',
image: '/resources/products/item5.jpg',
price: '14999'
},
{
id:6,
name: 'Dell',
description: 'Prisvärd',
image: '/resources/products/item6.jpg',
price: '2999'
},
{
id:7,
name: 'Chromebook',
description: 'Smidig',
image: '/resources/products/item7.jpg',
price: '4699'
},
{
id:8,
name: 'Macintosh',
description: 'Veteran',
image: '/resources/products/macintosh.jpg',
price: '7999'
}
],
shoppingCart: [],
cartCount: 0,
cartSum: 0
}
},
methods:{
addToCart(product){
this.shoppingCart.push(product);
this.cartCount = this.shoppingCart.length;
},
sumOfCart(product){
cartSum += product.price;
}
}
});
app.mount('#app');