2r-image 中文文档教程
2r-image
React 中实现的 2R 库图像组件。
Instalation
2r-image
可作为 npm 包使用。 只需运行 npm install 2r-image
命令。
在您的项目中使用它:
import image from '2r-image'; // ES6 syntax
var image = require('2r-image'); // ES5 syntax
Usage & API
可以将以下道具传递给组件:
src
(String, required): 图片的 urlwidth
(Number): 的宽度图像(默认为'auto'
)height
(数字):图像的高度(默认为'auto'
)alt
(String):alt
属性的值(默认为''
)classes
(String): 一串多个类,以空格分隔(默认为''
)
Examples
项目中有一个示例文件夹,配置最少。 运行步骤:
克隆项目并
运行
npm install
运行
gulp examples
导航到
http://localhost:5000
License
本软件发布于WTFPL v2.0 许可证的条款。
2r-image
2R library image component implemented in React.
Instalation
2r-image
is available as an npm package. Simply run npm install 2r-image
command.
To use it in your project:
import image from '2r-image'; // ES6 syntax
var image = require('2r-image'); // ES5 syntax
Usage & API
The following props can be passed to the component:
src
(String, required): the url of the imagewidth
(Number): width of the image (defaults to'auto'
)height
(Number): height of the image (defaults to'auto'
)alt
(String): the value of thealt
attribute (defaults to''
)classes
(String): a string of multiple classes, separated by space (defaults to''
)
Examples
There is an examples folder inside the project with a minimum config. Steps to run:
Clone the project and
Run
npm install
Run
gulp examples
Navigate to
http://localhost:5000
License
This software is released under the terms of WTFPL v2.0 license.