Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x | /// <reference types="@uiw/react-baidu-map-types" />
import React, { CSSProperties, useImperativeHandle } from 'react';
import { OverlayProps } from '@uiw/react-baidu-map-map';
import { useLabel } from './useLabel';
export * from './useLabel';
export interface LabelProps extends OverlayProps, BMap.LabelOptions, BMap.LabelEvents {
/**
* 文本标注内容
*/
content?: string;
/**
* 文本标注样式,该样式将作用于文本标注的容器元素上。
* 其中styles为JavaScript对象常量,比如: setStyle({ color : "red", fontSize : "12px" })
* 注意:如果css的属性名中包含连字符,需要将连字符去掉并将其后的字母进行大写处理,
* 例如:背景色属性要写成:backgroundColor
*/
style?: CSSProperties;
children?: JSX.Element;
}
export default React.forwardRef<LabelProps & { label?: BMap.Label }, LabelProps>((props, ref) => {
const { label, Portal } = useLabel({ ...props });
useImperativeHandle(ref, () => ({ ...props, label }), [label, props]);
return <Portal>{props.children}</Portal>;
});
|