<script>
import Slider from './Slider'
import {mapState} from 'vuex'
//import axios from 'axios';
export default {
name: "Slider",
components: {
Slider
},
props: {
numSlides: {
type: Number,
default: 5
},
itemsPerPageCssStyle: {
type: String,
default: "slider5buckets" // need to eventually make this dynamic, logic is in GridDynamic_DynamicProductRecs.java on lines 125-130
}
},
data: function () {
return {
products: [
{id: 1, img: 'https://placeimg.com/100/100', price: 4.56},
{id: 2, img: 'https://placeimg.com/101/101', price: 1.23},
{id: 3, img: 'https://placeimg.com/102/102', price: 2.34},
{id: 4, img: 'https://placeimg.com/103/103', price: 9.87},
{id: 5, img: 'https://placeimg.com/104/104', price: 3.45},
{id: 6, img: 'https://placeimg.com/105/105', price: 12.34},
],
params: this.$parent.params
}
},
computed: {
...mapState({
selStoreID: state => state.selectedStoreId,
//baseUri: state => state.uri.application || '/main/',
serviceHost: state => state.uri.service
}),
},
mounted() {
console.log('strategy: ' + this.params.strategy);
this.initSlider();
},
methods: {
initSlider () {
let vm = this;
let vmStore = vm.selStoreID;
console.log(vmStore);
<template>
<div
id="recommendedProductsDetailsHorizontal"
:class="['imageSliderContainer', itemsPerPageCssStyle]"
style="width:100%;height:374px;">
<h2>{{ params.headerText }}</h2>
<div
class="wrapper"
style="height:355px;">
<div class="carousel-view">
<carousel
:navigation-enabled="true"
:min-swipe-distance="1"
:per-page="5"
navigation-next-label="<i class='fas fa-angle-right'></i>"
navigation-prev-label="<i class='fas fa-angle-left'></i>">
<slide
v-for="product in products"
:key="product.id">
<div class="img-container">
<a
href="#"
class="handCursor"
tabindex="0">
<img
:src="product.img"
:alt="'Product #' + product.id">
</a>
</div>
<h4>Product #{{ product.id }}</h4>
<div class="price-div">
<div class="allPriceDescriptionPage">${{ product.price }}</div>
</div>
<a
href="#"
tabindex="0"
name="instantadd">
<div class="btn_CA_Search buttonSearch gradient"> Add to Cart</div>
</a>
</slide>
</carousel>
</div>
</div>
</div>
</template>