使用 我的应用 也是一种 支持 我的方式:
DockLift: 点击 Dock 应用窗口回到当前屏幕 Zipora: Zip/RAR/7Z 解压工具 Scap: Screenshot & Markup Edit Screen Test Deskmark Keyzer Vidwall Hub VidCrop Vidwall Mousio Hint Mousio Musicer Audioer FileSentinel FocusCursor Videoer KeyClicker DayBar Iconed Menuist Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

Carousel 走马灯 === [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) [![Telegram Channel](https://img.shields.io/badge/%20-Telegram-00618f.svg?logo=Telegram)](https://t.me/s/AwesomeMacApps) [![Follow On X](https://img.shields.io/badge/Follow%20on%20X-333333?logo=x&logoColor=white)](https://x.com/jaywcjlove) [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-carousel/file/README.md) [![NPM Downloads](https://img.shields.io/npm/dm/@uiw/react-carousel.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-carousel) [![npm version](https://img.shields.io/npm/v/@uiw/react-carousel.svg?label=@uiw/react-carousel)](https://npmjs.com/@uiw/react-carousel) 滚动播放。在 v4.15.0+ 添加。 ```jsx import { Carousel } from 'uiw'; // or import Carousel from '@uiw/react-carousel'; ``` ## 基础用法 最简单的用法。 ```jsx mdx:preview import React from 'react'; import { Carousel } from 'uiw'; export default function Demo() { return (
1
2
3
4
1
2
3
4
); } ``` ## 控制播放频率 palyTime设置每帧停留时间,scrollTime设置切换帧的速度 ```jsx mdx:preview import React from 'react'; import { Carousel } from 'uiw'; export default function Demo() { return (
1
2
3
4
); } ``` ## 切换到指定帧 手动切换到指定帧的位置 ```jsx mdx:preview import React from 'react'; import { Carousel } from 'uiw'; export default function Demo() { const ref=React.useRef() const [autoPlay,autoPlaySet]=React.useState(true) return ( console.log('after',current)} beforeChange={(current)=>console.log('before',current)} >
1
2
3
4
); } ``` ## Props ## API | 参数 | 说明 | 类型 | 默认值 | |--------- |-------- |--------- |-------- | | width | 宽度 | number | 400 | | height | 高度 | number | 200 | | position | 设置初始帧位置 | number | 0 | | palyTime | 每帧停留时间(ms) | number | 2000 | | scrollTime | 滚动动画的速度(ms) | number | 200 | | autoPlay | 是否自动播放 | boolean | true | | afterChange | 切换面板前的回调 | (current) => void | - | | beforeChange | 切换面板后的回调 | (current) => void | - | | direction | 滚动方位`horizontal`横向,`vertical`竖向 | horizontal \| vertical | horizontal | ### ref ```ts // 跳转到指定帧 gotoSlide: (slideNumber: number) => void; // 上一针 prevSlide: () => void; // 下一帧 nextSlide: () => void; // 暂停播放 stopPlay: () => void; ```