1
import * as React from 'react';
2
import { ImageLoadEvent, ImageErrorEvent, TapEvent, TouchStartEvent } from '../../../types';
3

4 3
export { default as defaults } from './default';
5

6
interface CommonProps {
7
  // 通用属性
8
  readonly dataset?: DOMStringMap;
9
  id?: string;
10
  className?: string;
11
  style?: React.CSSProperties;
12
  /** 图片资源地址 */
13
  src?: string;
14
  /** 图片裁剪、缩放的模式 */
15
  mode?:
16
    | 'scaleToFill'
17
    | 'aspectFit'
18
    | 'aspectFill'
19
    | 'widthFix'
20
    | 'top'
21
    | 'bottom'
22
    | 'center'
23
    | 'left'
24
    | 'right'
25
    | 'top left'
26
    | 'top right'
27
    | 'bottom left'
28
    | 'bottom right';
29
}
30

31
export default interface ImageProps extends CommonProps, React.AriaAttributes {
32
  /** 当图片载入完毕时触发 */
33
  onLoad?: (e: ImageLoadEvent) => void;
34
  /** 当错误发生时触发 */
35
  onError?: (e: ImageErrorEvent) => void;
36
  onTap?: (e: TapEvent) => void;
37
  onTouchStart?: (e: TouchStartEvent) => void;
38
  onTouchMove?: (e: TouchStartEvent) => void;
39
  onTouchEnd?: (e: TouchStartEvent) => void;
40
  onTouchCancel?: (e: TouchStartEvent) => void;
41
}
42

43
export interface ImageWebProps extends CommonProps, React.HTMLAttributes<HTMLImageElement> {
44
  onTap?: (e: React.MouseEvent<HTMLImageElement>) => void;
45
}

Read our documentation on viewing source code .

Loading