UNPKG

test-nut-ui

Version:

<p align="center"> <img alt="logo" src="https://img11.360buyimg.com/imagetools/jfs/t1/211965/25/7152/22022/61b16785E433119bb/aa41d7a9f7e823f3.png" width="150" style="margin-bottom: 10px;"> </p>

80 lines (79 loc) 1.83 kB
import React, { FunctionComponent, ReactNode } from 'react'; import { BasicComponent } from '../../utils/typings'; import '@nascent/nutui-icons-react/lib/style.css'; export interface ImageProps extends BasicComponent { /** * 图片链接 * @default - */ src: string /** * 图片填充模式,等同于原生的 object-fit 属性 * @default fill */ fit: ImageFit /** * 图片位置,等同于原生的 object-position 属性 * @default center */ position: ImagePosition /** * 替代文本 * @default - */ alt: string /** * 宽度,默认单位px * @default - */ width: string /** * 高度,默认单位px * @default - */ height: string /** * 圆角大小 * @default - */ radius: string | number /** * 是否展示图片加载失败 * @default true */ error: boolean | ReactNode /** * 是否展示加载中图片 * @default true */ loading: boolean | ReactNode /** * 是否为懒加载图片 * @default false */ lazy: boolean /** * 图标尺寸 l | m * @default m */ size: 'l' | 'm' alawaysShowLoading: boolean; /** * 点击图片时触发 * @default - */ onClick: (e: MouseEvent) => void /** * 图片加载完后触发 * @default - */ onLoad: () => void /** * 图片加载失败后触发 * @default - */ onError: () => void } export type ImageFit = 'contain' | 'cover' | 'fill' | 'none' | 'scale-down' | string; export type ImagePosition = 'center' | 'top' | 'right' | 'bottom' | 'left' | string; export declare const Image: FunctionComponent<Partial<ImageProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onLoad' | 'onError'>>;