We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
该组件位于 路由中
const MyMap: React.FC<MyMapProps> = ({ position, onClick }) => { const [ranging, setRanging] = useState(false); const [rule, setRule] = useState<any>({}); const style = useStyles(); const plugins: any = [ 'Scale', 'OverView', // v1.1.0 新增 'ControlBar', 'ToolBar', ]; const events = { click: (map: any) => { onClick(map); }, created(instance: any) { window.AMap.plugin(['AMap.RangingTool'], () => { const rule = new window.AMap.RangingTool(instance, getMapPlugins()); setRule(rule); }); }, }; useEffect(() => { if (!rule.turnOn) { return; } if (ranging) { rule.turnOn(); } else { rule.turnOff(); } }, [rule, ranging]); return ( <Map viewMode="3D" zoom={15} plugins={plugins} loading={ <div className={style.loadingFather}> <Spin tip="加载中" size="large" /> </div> } center={position} events={events} > <Marker position={position} draggable visible={!ranging} /> <div className={style.customLayer}> <Button title="开启测距" onClick={() => setRanging(true)}> 开启测距 </Button> <Button title="关闭测距" onClick={() => setRanging(false)}> 结束测距 </Button> </div> </Map> ); }; export default MyMap;
在切换组件的时候发生了如下错误
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Reproduce Example Link or Code Fragment
该组件位于 路由中
What is actually happening?
在切换组件的时候发生了如下错误
The text was updated successfully, but these errors were encountered: