---
title: 图片
group:
  path: /Basic
  title: 基础组件
---

## 按钮  


```jsx  
import React, { useState, useEffect } from 'react';  
import { Image } from '@dndc/pudge-basic';  
import Hocs from '@dndc/pudge-basic/es/components/hocs';
import { EventType } from '@dndc/pudge-basic/es/utils/system';

const props = { link: { href: "//www.baidu.com" } };  
const style = {
  width:375,
  ratio:0.5,
  boxShadowStyle:'hover',
  boxShadow: [3,3,3,'rgba(0,0,0,0.25)'],
};
const init = { scale: 1,x: 0, y: 0 };
const animation = { init, event: EventType.HOVER, x: 0, scale: 1.2, duration: 3000 };
const data = {
  type:'Image',
  props,
  style,
  animation
};

export default () => {
  return <Image data={data} />
};  
```  

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

属性 | 说明 |  类型  | 默认值 | 版本  
-|-|-|-|-  
width | 宽度 | strig | 200px | 1.0.0  
height | 高度 | strig | 44px | 1.0.0  
alignSelf | 相对于外部容器对齐方式 | strig | center | 1.0.0  
widthOverLayout | 是否宽度100% | bool | false | 1.0.0  
alignwidthSelf | 宽度 | strig | 200px | 1.0.0  
backgroundColor | 背景颜色 | strig | primaryColor(主题色) | 1.0.0  
borderWidth | 边框宽度 | strig | 1px | 1.0.0  
borderColor | 边框颜色 | strig | rgb(24, 144, 255) | 1.0.0  
color | 颜色 | strig | #fff | 1.0.0  
margin | 外边距 | Array | ['0px', '0px', '0px', '0px'] | 1.0.0  
hoverColor | 鼠标聚焦颜色 | strig | #fff | 1.0.0  
activeColor | 鼠标点击颜色 | strig | #fff | 1.0.0  
fontSize | 字体带下 | strig | 16px | 1.0.0  
inline | 是否行内按钮 | bool | false | 1.0.0  

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  