SSENSE / vue-carousel

A flexible, responsive, touch-friendly carousel for Vue.js
https://ssense.github.io/vue-carousel/
MIT License
1.72k stars 506 forks source link

Custom Navigation Buttons #427

Open rishabhgoel9797 opened 5 years ago

rishabhgoel9797 commented 5 years ago

i am not able to use navigation-prev-label='<img src="~/assets/images/banner-left.svg">'

digi-com commented 5 years ago

Try something like this?

navigation-next-label=""
navigation-prev-label=""
.VueCarousel-navigation-next::after {
  content: url('/images/banner-right.svg');
}
.VueCarousel-navigation-prev::after {
  content: url('/images/banner-left.svg');
}
phuclh commented 5 years ago

@digi-com Is that possible to make my own custom button? Something like that:

Screen_Shot_2019-04-23_at_12_58_21_PM
xiashaxs commented 5 years ago

In template,

<carousel
    :navigation-enabled="true"
    :navigation-next-label="nextLabel"
    :navigation-prev-label="prevLabel"
>
</carousel>

In script,

data () {
    return {
        nextLabel: "<img src='/assets/images/chevron-right.png' />",
        prevLabel: "<img src='/assets/images/chevron-left.png' />"
    }
}
nabilfreeman commented 4 years ago

Thanks so much @shasarah !!!

panfanky commented 3 years ago

@shasarah this sounds like an answew, but gives me " Property or method "nextLabel" is not defined on the instance but referenced during render" when having this in .vue file:

<template>
  <div>
    <slot/>
  </div>
</template>
<script>

import Vue from 'vue';
import Carousel from 'vue-carousel';
Vue.use(Carousel);
import Slide from 'vue-carousel';
Vue.use(Slide);

export default {
  components: {
    'carousel': Carousel,
    'slide': Slide
  },
  methods: {
  },
  props: {
  },
  data() {
    return {
    nextLabel: "<i class='ico--chevron-right'></i>",
    prevLabel: "<i class='ico--chevron-left'></i>"
      }
  }
}

</script>

and this in html file:

<carousel :per-page=1 :navigation-enabled="true" :navigation-prev-label="prevLabel"  :navigation-next-label="nextLabel" class="article-card-list pt-12 pb-8">
              <slide>lorem</slide>
              <slide>ipsum</slide>
</carousel>

Thanks so much anyone who knows!

GileadGaf commented 3 years ago

try to use computed instead of data