UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

30 lines (29 loc) 1.18 kB
import * as React from 'react'; import { Rect, BoundingRect, Margin } from 'react-measure'; interface IMeasureProps { /** client: clientWidth, clientHeight, clientTop, clientLeft */ onClient?: (client: Rect | undefined) => void; /** offset: offsetWidth, offsetHeight, offsetTop, offsetBottom */ onOffset?: (offset: Rect | undefined) => void; /** scroll: scrollWidth, scrollHeight, scrollTop, scrollBottom */ onScroll?: (scroll: Rect | undefined) => void; /** bound: left, top, right, bottom, x, y, width, height */ onBounds?: (bound: BoundingRect | undefined) => void; /** margin: marginLeft, marginRight, marginTop, marginBottom */ onMargin?: (margin: Margin | undefined) => void; /** 获取内部元素的引用 */ onInnerRef?: (ref: Element | null) => void; children: any; [key: string]: any; } /** * 动态获取元素属性 * e.g. <ElementMeasure * onClient={(client) => this.setState({width: client.width})}> * <div>{this.state.width}</div> * </ElementMeasure> */ export default class ElementMeasure extends React.Component<IMeasureProps, any> { render(): React.JSX.Element; } export {};