---
title: 轮播
group:
  path: /Business
  title: 业务基础组件
---

## 轮播

```jsx
import React from 'react';
import { Swiper } from '@dndc/pudge-basic';

const props = { text: '按钮', hasNavigation: true };
const style = {
  width:'100px',
  pagination: {
    '.swiper-pagination-bullet': {
      width: '6px',
      height: '4px',
      background: '#a0a0a0',
      'border-radius': '2px',
    },
    '.swiper-pagination-bullet-active': {
      background: '#fff',
      width: '14px',
      height: '4px',
    },
  },
  backgroundColor:'#000'
};
const data = {
  type: 'Swiper',
  props,
  style,
  children:[]
};
const wrapStyle = {position:'relative',width:400};
export default () => 
<div style={wrapStyle}>
  <Swiper data={data} >
    <div><img style={{width:'100%'}} src='https://video-react.js.org/assets/poster.png' /></div>
    <div><img style={{width:'100%'}} src='https://video-react.js.org/assets/poster.png' /></div>
  </Swiper>
  </div>;
```

### 1.可配置 style, 默认样式配置:

| 属性 | 说明 | 类型 | 默认值 | 版本 |
| ---- | ---- | ---- | ------ | ---- |


example

```json
 style: {
      alignSelf: 'center',
      widthOverLayout: false,
      width: '200px',
      backgroundColor: primaryColor,
      borderWidth: '1px',
      borderColor: 'rgb(24, 144, 255)',
      color: '#fff',
      margin: ['0px', '0px', '0px', '0px'],
      hoverColor: '#fff',
      activeColor: '#fff',
      fontSize: '16px',
      height: '44px',
      inline: false,
    }
```

### 2.默认数据配置:

| 属性 | 说明 | 类型  | 默认值 | 版本  |
| ---- | ---- | ----- | ------ | ----- |
| text | 文字 | strig | 按钮   | 1.0.0 |
| href | 链接 | strig |        | 1.0.0 |

example

```json
 props: {
      text: '按钮',
      href: '',
    }
```

### 3.事件 API:

| 属性    | 说明 | 类型 | 版本  |
| ------- | ---- | ---- | ----- |
| onClick | 点击 | Fun  | 1.0.0 |
