slider.vue 827 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <div class="slider mb-4">
  3. <swiper v-bind="config" :style="options.style" class="rounded-lg overflow-hidden">
  4. <slide v-for="(node, index) in options.children" :style="options.slideStyle" :key="index" class="flex">
  5. <v-image :options="node" class="object-cover w-full"></v-image>
  6. </slide>
  7. </swiper>
  8. </div>
  9. </template>
  10. <script>
  11. import { Swiper, Slide } from 'vue-swiper-component';
  12. import Base from './base';
  13. export default {
  14. name: 'v-slider',
  15. extends: Base,
  16. components: {
  17. Swiper,
  18. Slide,
  19. },
  20. props: {
  21. options: Object,
  22. },
  23. computed: {
  24. config() {
  25. return {
  26. autoPlay: false,
  27. showIndicator: true,
  28. interval: 5000,
  29. duration: 500,
  30. ...(this.options.config || {})
  31. }
  32. }
  33. }
  34. }
  35. </script>
  36. <style lang="less">
  37. </style>