-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
103 lines (97 loc) · 2.71 KB
/
App.vue
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
<div class="app">
<Nav></Nav>
<swiper :options="swiperOption" ref="mySwiper">
<swiper-slide>
<promo></promo>
</swiper-slide>
<swiper-slide>
<div class="products">
<div class="clearfix">
<product v-for="product in products" :product="product" :key="product.id"></product>
</div>
</div>
</swiper-slide>
<swiper-slide>
<div class="shopping-cart">
<shopping-cart></shopping-cart>
</div>
</swiper-slide>
</swiper>
</div>
</template>
<script>
import ShoppingCart from './components/ShoppingCart.vue'
import Product from './components/Product.vue'
import Promo from './components/Promo.vue'
import Nav from './components/Nav.vue'
import 'swiper/dist/css/swiper.css'
import {swiper, swiperSlide} from 'vue-awesome-swiper'
export default {
name: 'carrousel',
created () {
// fetch data from server
// i m using dummy data for now..
var dummy = [
{id: 1, title: 'Cardinal Thive and Succeed Hoodie', price: 49.99, image: 'CardinalThriveSucceedHoodie.png'},
{id: 2, title: 'Maroon Thrive and Succeed Shirt', price: 21.99, image: 'MaroonThriveSucceedShirt.png'},
{id: 3, title: 'Orange Thrive and Succeed Crewneck', price: 39.99, image: 'OrangeThriveSucceedCrew.png'},
{id: 4, title: 'Name of Product 4', price: 20, image: 'logo.png'},
{id: 5, title: 'Cardinal Thive and Succeed Hoodie', price: 49.99, image: 'CardinalThriveSucceedHoodie.png'},
{id: 6, title: 'Maroon Thrive and Succeed Shirt', price: 21.99, image: 'MaroonThriveSucceedShirt.png'},
{id: 7, title: 'Orange Thrive and Succeed Crewneck', price: 39.99, image: 'OrangeThriveSucceedCrew.png'},
{id: 8, title: 'Name of Product 4', price: 20, image: 'logo.png'}
];
this.products = dummy
},
data () {
return {
products: [],
swiperOption: {
autoHeight: true
}
}
},
methods:{
nextSlide(){
this.swiper.slideNext(1000, false)
this.swiper.updateAutoHeight(500)
},
prevSlide(){
this.swiper.slidePrev(1000, false)
this.swiper.updateAutoHeight(500)
}
},
computed:{
swiper() {
return this.$refs.mySwiper.swiper
}
},
components: { Product, ShoppingCart, swiper, swiperSlide, Promo, Nav }
}
</script>
<style lang="scss">
@import '../node_modules/bootstrap/scss/bootstrap.scss'
</style>
<style>
html{
height: 100%;
width: 100%;
}
body {
background-color: black;
color: white;
font-family: 'Raleway', sans-serif;
}
.clearfix:after {
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.swiper-container {
width: 100%;
height: 100%;
}
</style>