25.2.17
This commit is contained in:
parent
5af24a0fce
commit
9064a35a94
@ -102,6 +102,13 @@ class BaseMap extends React.Component {
|
|||||||
this.getAllProvince();
|
this.getAllProvince();
|
||||||
this.createMap();
|
this.createMap();
|
||||||
}
|
}
|
||||||
|
componentWillUnmount = () => {
|
||||||
|
// 组件卸载时,清除地图
|
||||||
|
this.state.map.map.destroy();
|
||||||
|
this.state.map.destroy();
|
||||||
|
this.setState = null;
|
||||||
|
console.log('组件卸载时,清除地图');
|
||||||
|
}
|
||||||
// 创建地图
|
// 创建地图
|
||||||
createMap = () => {
|
createMap = () => {
|
||||||
const scene = new Scene({
|
const scene = new Scene({
|
||||||
@ -128,6 +135,7 @@ class BaseMap extends React.Component {
|
|||||||
if (DistrictAdcode) {
|
if (DistrictAdcode) {
|
||||||
this.onDistrictChange(DistrictAdcode, DistrictData);
|
this.onDistrictChange(DistrictAdcode, DistrictData);
|
||||||
}
|
}
|
||||||
|
// 地图拖拽鼠标图标更改
|
||||||
let can = document.getElementsByClassName('amap-layer')[0];
|
let can = document.getElementsByClassName('amap-layer')[0];
|
||||||
can.addEventListener('mousedown', (e) => {
|
can.addEventListener('mousedown', (e) => {
|
||||||
console.log('mousedown', can);
|
console.log('mousedown', can);
|
||||||
|
Loading…
Reference in New Issue
Block a user