huiyan-fe / mapv

a library of geography visualization-地理信息可视化库
http://mapv.baidu.com
BSD 3-Clause "New" or "Revised" License
2.58k stars 786 forks source link

单页面应用,调用这个方法后,mapvLayer.destroy();或者mapvLayer.hide(); 再new mapv.baiduMapLayer生成新的对象,click时会报错,Cannot read property 'canvas' of null #261

Open shiliangL opened 3 years ago

shiliangL commented 3 years ago

image image

yangdong520 commented 3 years ago

全是bug 真的老老实实用原生态,或者直接放弃百度

jawn-ha commented 2 years ago

解决了吗?遇到同样的问题

vaebe commented 1 year ago

目前使用的解决办法时,数据更新时不销毁图层。而是通过 dataset.set 方式设置新的数据

数据更新好像确实不应该销毁图层

//  不存在则创建, 存在则设置为新的值
  if (!baiduMapLayerData.value) {
    baiduMapLayerData.value = new DataSet(pointList)
  } else {
    baiduMapLayerData.value.set(pointList)
  }