当前位置:网站首页>Baidu map API drawing points and tips
Baidu map API drawing points and tips
2022-06-24 13:58:00 【Liz Liz】
import React, {
Component } from 'react';
import {
message } from 'antd';
import './index.less';
import httpClient, {
RESPONSE_OK } from '../../service/httpClient';
import apis from '../../service/config';
class MapStyle extends Component {
constructor(props) {
super(props);
this.state = {
mapName: ' Address ',
mapContent: ' Magic Castle Balala Wula Wula pineapple mango strawberry Street 2021-04-27 No. Road '
}
}
component() {
this.getInfo();
}
getInfo = async () => {
let res = await httpClient.post(apis.mapInfoGet, {
});
if(res.code === RESPONSE_OK) {
let point = new BMap.Point(res.result.lng, res.result.lat);
this.mapInit(point);
this.openMapInfo(point);
}
}
// Initialize map
mapInit = (point) => {
this.map = new BMap.Map('rescMap', {
enableMapClick: false,
});
this.map.centerAndZoom(
new BMap.Point(point),
15
);
this.map.enableScrollWheelZoom(true); // Enable the scroll wheel to zoom in and out , Default disabled
this.map.setDefaultCursor("url('bird.cur')"); // Set the default mouse pointer style of the map
let marker = new BMap.Marker(point); // Create annotations
this.map.addOverlay(marker);
marker.addEventListener("click", () => {
this.openMapInfo(point);
});
}
openMapInfo = (point) => {
const {
mapName, mapContent } = this.state;
let opts = {
position: point,
width: 25, // Information window width
height: 10, // Information window height
title: mapName // Message window title
}
let infoWindow = new BMap.InfoWindow(mapContent, opts); // Create information window object
this.map.openInfoWindow(infoWindow, point);
}
render() {
return(<div>
<div id="rescMap" className='rdl-map-content'></div>
</div>);
}
}
export default MapStyle;

边栏推荐
- Kotlin anonymous function and lambda
- 2022年氟化工艺考试模拟100题及答案
- 2022起重信号司索工(建筑特殊工种)复训题库及答案
- 杰理之可能出现有些芯片音乐播放速度快【篇】
- Harmony os. (2)
- 2022年煤炭生产经营单位(安全生产管理人员)考试题模拟考试平台操作
- MIT-6.824-lab4A-2022(万字讲解-代码构建)
- Operation of simulated examination platform of examination question bank for B certificate of Jiangxi provincial safety officer in 2022
- Daily question 8-515 Find the maximum value in each tree row
- Docker installation redis
猜你喜欢
![[5g NR] 5g NR system architecture](/img/78/6db70c18887c7a3920843d1cb4bdf3.png)
[5g NR] 5g NR system architecture

国内首款开源MySQL HTAP数据库即将发布,三大看点提前告知

居家办公更要高效-自动化办公完美提升摸鱼时间 | 社区征文

《中国数据库安全能力市场洞察,2022》报告研究正式启动

Vulnerability management mistakes that CIOs still make

Rongyun communication has "hacked" into the heart of the bank

Dragon lizard developer said: first time you got an electric shock, so you are such a dragon lizard community| Issue 8

Télétravail: Camping à la maison gadgets de bureau | rédaction communautaire

AntD checkbox,限制选中数量

图扑软件数字孪生海上风电 | 向海图强,奋楫争先
随机推荐
Tupu software is the digital twin of offshore wind power, striving to be the first
The hidden corner of codefarming: five things that developers hate most
[sdx62] wcn685x IPA failure analysis and solution
**Puzzling little problem in unity - light and sky box
2022年煤炭生产经营单位(安全生产管理人员)考试题模拟考试平台操作
2022 recurrent training question bank and answers for hoisting signal Rigger (special type of construction work)
Vulnerability management mistakes that CIOs still make
项目经理搭建团队,需要看6个特征
杰理之可能出现有些芯片音乐播放速度快【篇】
Autorf: learn the radiation field of 3D objects from single view (CVPR 2022)
吉时利静电计宽测量范围
Daily question 8-515 Find the maximum value in each tree row
2022年烟花爆竹生产单位安全生产管理人员考试题模拟考试题库模拟考试平台操作
2022年施工升降机司机(建筑特殊工种)考试试题及在线模拟考试
Detailed explanation of kotlin collaboration lanch
《中国数据库安全能力市场洞察,2022》报告研究正式启动
Kotlin coordination channel
kotlin 关键字 扩展函数
kotlin 接口 泛型 协变 逆变
kotlin 组合挂起函数