react-amap icon indicating copy to clipboard operation
react-amap copied to clipboard

marker 组件不能在地图上显示!

Open Burain opened this issue 6 years ago • 7 comments

  • [ ] 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
  • [ ] 我已经搜索过文档,并且仍然没有找到解决方案。

1:之前是正常的,什么也没有升级,突然间marker 组件就不能使用了!(就完全不能在地图上显示) 2:之前高德地图的版本是1.3.0, react-amap 的版本是 1.0.3 ! 3: 报错为: Cannot read property '_amap_id' of undefined! 4:升级各个版本到最新的之后,还是报相同的错误! 5:其他功能还可以使用,就只是marker不能正常使用和显示!

Burain avatar Jun 05 '18 07:06 Burain

发现 marker 组件 的 visible 不能使用

Burain avatar Jun 05 '18 08:06 Burain

官方marker demo 里面的visible属性 也不能正常传切换 https://elemefe.github.io/react-amap/components/marker

Burain avatar Jun 05 '18 09:06 Burain

marker visible 的问题在这里解决了。

ioslh avatar Jun 14 '18 09:06 ioslh

关于 marker 不能在地图上显示这个我没有重现,有在线重现的示例或者相应的代码吗?

ioslh avatar Jun 14 '18 10:06 ioslh

    <Map
      events={null}
      center={this.position}
      amapkey="788e08def03f95c670944fe2c78fa76f"
      dragEnable={false}
      zoom={12}
    >
      <Marker position={this.position} />
    </Map>

同样遇到标记消失的情况,我这是events={null}引起的去除就可以了。

WaltsonGao avatar Aug 27 '18 11:08 WaltsonGao

  • [ ] 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
  • [ ] 我已经搜索过文档,并且仍然没有找到解决方案。

1:之前是正常的,什么也没有升级,突然间marker 组件就不能使用了!(就完全不能在地图上显示) 2:之前高德地图的版本是1.3.0, react-amap 的版本是 1.0.3 ! 3: 报错为: Cannot read property '_amap_id' of undefined! 4:升级各个版本到最新的之后,还是报相同的错误! 5:其他功能还可以使用,就只是marker不能正常使用和显示!

_amap_id 这个问题怎么解决的啊

hankyum avatar Feb 25 '20 03:02 hankyum

import { PageContainer } from '@ant-design/pro-layout';
import { Map, Marker } from 'react-amap';
export default ()=>{
  return (
    <PageContainer>
      <div style={{ width: 900, height: 600 }}>
        <Map zoom={6} center={this.state.mapCenter}>
          <Marker position={
            {
              longitude: 114,
              latitude: 30,
            }
          }/>
        </Map>
      </div>
    </PageContainer>
  );
}

这样在antd pro中运行会报错cannot read properties of undefined (reading '_amap_id') 但是如下运行不会报错

import { Map, Marker } from 'react-amap';
export default ()=>{
  return (
    <div style={{ width: 900, height: 600 }}>
      <Map zoom={6} center={this.state.mapCenter}>
        <Marker position={
          {
            longitude: 114,
            latitude: 30,
          }
        }/>
      </Map>
    </div>
  );
}

HuangHeng179 avatar Dec 21 '21 13:12 HuangHeng179