1.0.2 • Published 3 years ago

amp-image v1.0.2

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

amp-image

React Image.

NPM version dumi CircleCI status Test coverage Dependencies DevDependencies npm download bundle size

Feature

  • Placeholder
  • Preview
  • Rotate
  • Zoom
  • Fallback
  • Multiple Preview

install

rc-image

Usage

npm install
npm start
const Image = require('rc-image');

ReactDOM.render(
  <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
), document.getElementById('root'));

API

NameTypeDefaultDescription
previewboolean | {visible: boolean,onVisibleChange:function(value, prevValue),getContainer: string | HTMLElement | (() => HTMLElement) | false }trueWhether to show preview
prefixClsstringrc-imageClassname prefix
placeholderboolean | ReactElement-if true will set default placeholder or use ReactElement set customize placeholder
fallbackstring-Load failed src
previewPrefixClsstringrc-image-previewPreview classname prefix
onError(event: Event) => void-Load failed callback

Image.PreviewGroup

preview the merged src

const Image = require('rc-image');

ReactDOM.render(
  <Image.PreviewGroup>
    <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
    <Image src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*P0S-QIRUbsUAAAAAAAAAAABkARQnAQ" />
  </Image.PreviewGroup>
), document.getElementById('root'));

API

NameTypeDefaultDescription
previewboolean | {visible: boolean,onVisibleChange:function(value, prevValue),getContainer: string | HTMLElement | (() => HTMLElement) | false }trueWhether to show preview
currentnumber0If Preview the show img index

Example

http://localhost:8003/examples/

Test Case

npm test

Coverage

npm run coverage

License

rc-image is released under the MIT license.