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, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useControl } from './useControl'; export * from './useControl'; export interface ControlProps extends OverlayProps { /** * 控件默认的停靠位置。自定义控件时需要提供此属性,作为控件的默认停靠位置 */ anchor?: BMap.ControlAnchor; /** * 控件默认的位置偏移值。自定义控件时需要提供此属性,作为控件的默认偏移位置 */ offset?: BMap.Size; /** * 自定义 DOM 元素。 */ children?: React.ReactNode; } export default React.forwardRef<ControlProps & { control?: BMap.Control }, ControlProps>((props, ref) => { const { control, ControlPortal } = useControl(props); useImperativeHandle(ref, () => ({ ...props, control }), [control, props]); return <ControlPortal>{props.children}</ControlPortal>; }); |