ElemeFE / ElemeFE/react-amap

引入react-amap-plugin-heatmap后报错

Open
#145 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
1k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

+ [x] 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
+ [x] 我已经搜索过[文档](https://elemefe.github.io/react-amap/articles/start),并且仍然没有找到解决方案。
+ [x] 我写了个问题重现的例子,链接或者代码将会贴在下面。

#### Reproduce Example Link or Code Fragment
引入react-amap-plugin-heatmap插件后报错, Cannot read property 'preventAmap' of undefined
报错代码:
return Children.map(this.props.children, function(child) {
if (child) {
var cType = child.type;
/* 针对下面两种组件不注入地图相关属性
* 1. 明确声明不需要注入的
* 2. DOM 元素
*/
console.log('cType======', cType);
if (cType.preventAmap || typeof cType === 'string') {
return child;
}
return _react2.default.cloneElement(child, {
__map__: _this2.map
});
}
return child;
});
}

#### What is Expected?
热力图可以正常加载,不报错

#### What is actually happening?
js报错,地图加载不出来

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.