承接 mrshanebarron/carousel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrshanebarron/carousel

最新稳定版本:v1.0.1

Composer 安装命令:

composer require mrshanebarron/carousel

包简介

Image carousel/slider component for Laravel - supports Livewire and Vue

README 文档

README

A responsive image/content carousel component for Laravel applications. Supports auto-play, navigation, and indicators. Works with Livewire and Vue 3.

Installation

composer require mrshanebarron/carousel

Livewire Usage

Basic Usage

<livewire:sb-carousel :slides="[
    ['image' => '/images/slide1.jpg', 'title' => 'Slide 1'],
    ['image' => '/images/slide2.jpg', 'title' => 'Slide 2'],
    ['image' => '/images/slide3.jpg', 'title' => 'Slide 3']
]" />

Auto-play

<livewire:sb-carousel :slides="$slides" :autoplay="true" :interval="5000" />

With Navigation

<livewire:sb-carousel
    :slides="$slides"
    :show-arrows="true"
    :show-indicators="true"
/>

Livewire Props

Prop Type Default Description
slides array required Array of slide objects
autoplay boolean false Auto-advance slides
interval number 3000 Autoplay interval (ms)
show-arrows boolean true Show prev/next arrows
show-indicators boolean true Show dot indicators

Vue 3 Usage

Setup

import { SbCarousel } from './vendor/sb-carousel';
app.component('SbCarousel', SbCarousel);

Basic Usage

<template>
  <SbCarousel :slides="slides" />
</template>

<script setup>
const slides = [
  { image: '/images/slide1.jpg', title: 'First Slide' },
  { image: '/images/slide2.jpg', title: 'Second Slide' },
  { image: '/images/slide3.jpg', title: 'Third Slide' }
];
</script>

With Auto-play

<template>
  <SbCarousel
    :slides="slides"
    autoplay
    :interval="4000"
  />
</template>

Custom Slides via Slot

<template>
  <SbCarousel :slide-count="products.length">
    <template #slide="{ index }">
      <div class="p-8 text-center">
        <img :src="products[index].image" class="mx-auto" />
        <h3 class="text-xl font-bold mt-4">{{ products[index].name }}</h3>
        <p class="text-gray-600">{{ products[index].price }}</p>
      </div>
    </template>
  </SbCarousel>
</template>

Hero Carousel

<template>
  <SbCarousel :slides="heroSlides" class="h-96" autoplay>
    <template #slide="{ slide }">
      <div
        class="h-full bg-cover bg-center flex items-center justify-center"
        :style="{ backgroundImage: `url(${slide.image})` }"
      >
        <div class="text-center text-white">
          <h2 class="text-4xl font-bold">{{ slide.title }}</h2>
          <p class="mt-2">{{ slide.description }}</p>
        </div>
      </div>
    </template>
  </SbCarousel>
</template>

Vue Props

Prop Type Default Description
slides Array [] Slide data array
autoplay Boolean false Auto-advance
interval Number 3000 Autoplay interval
showArrows Boolean true Navigation arrows
showIndicators Boolean true Dot indicators
slideCount Number - For slot-based slides

Events

Event Payload Description
change index Slide changed

Slots

Slot Props Description
slide { slide, index } Custom slide content

Slide Object

{
  image: '/path/to/image.jpg',  // Image URL
  title: 'Slide Title',          // Optional title
  description: 'Description',    // Optional description
  link: '/page'                  // Optional link
}

Features

  • Auto-play: Automatic slide advancement
  • Navigation: Previous/next arrows
  • Indicators: Clickable dot navigation
  • Touch Support: Swipe on mobile
  • Keyboard: Arrow key navigation
  • Responsive: Full-width responsive

Styling

Uses Tailwind CSS:

  • Full-width container
  • Centered arrows
  • Bottom indicators
  • Smooth transitions

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • Tailwind CSS 3.x

License

MIT License

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-16