Closed chenshuox closed 3 years ago
+1 忽然遇到这个问题
mac chrome 没问题 windows chrome 报错 cannot read property result of indefined
"react-bmapgl": "0.1.22",
class MapAddressBaidu extends React.Component {
constructor(props) {
super(props);
}
render() {
const that = this;
let centerLatLng = {lat: 31.14826, lng: 121.67196};
return (
<React.Fragment>
<Map
style={{width: "100%", height: "100%", marginTop: "10px", zIndex: 0}}
center={centerLatLng}
zoom={that.props.zoomLevel}
enableScrollWheelZoom={true}
onClick={(e) => this.props.onMapClickListener?.(e)}>
<ZoomControl />
<Marker position={centerLatLng} enableDragging />
</Map>
</React.Fragment>
);
}
}
export default MapApiLoaderHOC({ak: Constants.MAP_KEY_BAIDU})(MapAddressBaidu);
<MapAddressBaidu
style={{width: "100%", height: "100%", marginTop: "10px", zIndex: 0}}
centerLatLng={centerLatLng}
zoomLevel={14}
onMapClickListener={(e) => {
}}
/>
果然是浏览器版本差异导致的这个报错;
mac chrome version = 95.0.4638.54 报错;
mac safari version = 14.0.2 (16610.3.7.1.9) 无报错;
很神奇~
地图引擎bug,已经修改,上线中
还在发布吗? @Junior2Ran https://lbsyun.baidu.com/jsdemo.htm#aAsynLoadMap 依然看不到地图
依然有问题哦,能给个临时的解决方案吗? @Junior2Ran
依然有问题哦,能给个临时的解决方案吗? @Junior2Ran
临时解决方案就是换高德 [😏]
Uncaught TypeError: Cannot read properties of undefined (reading 'result')