当前位置:网站首页>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;

边栏推荐
- 2022年江西省安全员B证考试题库模拟考试平台操作
- 初识云原生安全:云时代的最佳保障
- kotlin 关键字 扩展函数
- 数学之英文写作——基本中英文词汇(几何与三角的常用词汇)
- Operation of simulated examination platform for examination questions of coal production and operation units (safety production management personnel) in 2022
- Activity lifecycle
- Telecommuting: camping at home office gadgets | community essay solicitation
- Docker安装redis
- Home office should be more efficient - automated office perfectly improves fishing time | community essay solicitation
- Tupu software is the digital twin of offshore wind power, striving to be the first
猜你喜欢

npm包【详解】(内含npm包的开发、发布、安装、更新、搜索、卸载、查看、版本号更新规则、package.json详解等)

Google waymo proposed r4d: remote distance estimation using reference target

AntD checkbox,限制选中数量
![Jerry's serial port receiving IO needs to set the digital function [chapter]](/img/04/48e7da42101a53827463d479952f67.png)
Jerry's serial port receiving IO needs to set the digital function [chapter]

**Puzzling little problem in unity - light and sky box
![Jerrys timer0 uses the default pa13 to detect the pulse width [chapter]](/img/4e/de0951c8be5ddd765b15b773c04fa7.png)
Jerrys timer0 uses the default pa13 to detect the pulse width [chapter]

Activity生命周期

华为 PC 逆势增长,产品力决定一切

10 reduce common "tricks"

OpenHarmony 1
随机推荐
Harmony os. (2)
Can a team do both projects and products?
90% of the project managers have skipped the pit. Are you still in the pit?
kotlin 共享可变状态和并发性
Gatling performance test
Kotlin interface generic covariant inversion
杰理之可能出现有些芯片音乐播放速度快【篇】
初识云原生安全:云时代的最佳保障
Jerry has opened a variety of decoding formats, and the waiting time from card insertion to playback is long [chapter]
PM should also learn to reflect every day
美国会参议院推进两党枪支安全法案
Jerry's serial port receiving IO needs to set the digital function [chapter]
[AI player cultivation record] use AI to identify what kind of wealth is next door
Activity生命周期
How to manage tasks in the low code platform of the Internet of things?
【sdx62】WCN685X IPA注册失败问题分析及解决方案
SAP Marketing Cloud 功能概述(四)
Prometheus pushgateway
钛星数安加入龙蜥社区,共同打造网络安全生态
服务可见可观测性