1.0.5 • Published 3 years ago

@y.dsh/swipe v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

react轮播图组件

引入css(在scss文件中)

@import '~@y.dsh/swipe/lib/index.css';
import Swipe from '@y.dsh/swipe'; 
const { SwipeItem } = Swipe;

<Swipe
  swipeStyle={{ height: 200 }}
>
  <SwipeItem
    swipeItemStyle={{ backgroundColor: 'red' }}
  >
    <span>红</span>
  </SwipeItem>
</Swipe>

Swipe参数

参数说明默认值类型必选
children子元素undefinedSwipeItem | SwipeItem[]
indicatorDots显示指示点trueboolean×
indicatorColor指示点颜色rgba(0, 0, 0, .3)string×
indicatorActiveColor选中指示点颜色#000000string×
autoplay无操作时自动播放falseboolean×
interval自动播放延迟时间5000number×
defaultCurrent初始化滑块的index0number×
current受控的滑块 与defaultCurrent同时配置 defaultCurrent将不生效undefinednumber×
duration停止滑块时滑块的动画时长500number×
circular是否采用衔接滑动falseboolean×
vertical滑动方向是否为纵向falseboolean×
previousMargin前边距 可用于露出前一项的一小部分 接受css单位0pxstring×
nextMargin后边距 可用于露出后一项的一小部分 接受css单位0pxstring×
displayMultipleItems同时显示的滑块数量 不包括前后边距导致露出来的块1number×
swipeItemOutsideHide在显示区域外的swipeItem块不渲染子节点falseboolean×
swipeClassNames最外层类名undefinedstring[] | string×
swipeStyle最外层样式{}React.CSSProperties×
onChange当前滑块索引变化的回调undefined(props: { current: number }) => void×
onTransition滑动时的回调 包括自动滑动undefined(props: { dx?: number, dy?: number }) => void×
onAnimationFinish滑块归位后的回调undefined(props: {dx?: number, dy?: number }) => void×

SwipeItem参数

参数说明默认值类型必选
children子元素undefinedReact.ReactNode×
swipeItemClassNamesItem类名undefinedstring[] | string×
swipeItemStyleItem样式{}React.CSSProperties×
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.1

3 years ago