huiyan-fe / react-bmapgl

基于百度地图JavaScript GL版API封装的React组件库
http://huiyan.baidu.com/github/react-bmapgl/
MIT License
115 stars 21 forks source link

result 读取报错 #28

Closed chenshuox closed 3 years ago

chenshuox commented 3 years ago

Uncaught TypeError: Cannot read properties of undefined (reading 'result')

image

krmao commented 3 years ago

+1 忽然遇到这个问题

mac chrome 没问题 windows chrome 报错 cannot read property result of indefined

image

"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) => {
          }}
/>
chenshuox commented 3 years ago

果然是浏览器版本差异导致的这个报错;

mac chrome version = 95.0.4638.54 报错;

mac safari version = 14.0.2 (16610.3.7.1.9) 无报错;

很神奇~

Junior2Ran commented 3 years ago

地图引擎bug,已经修改,上线中

krmao commented 3 years ago

还在发布吗? @Junior2Ran https://lbsyun.baidu.com/jsdemo.htm#aAsynLoadMap 依然看不到地图

krmao commented 3 years ago

image

依然有问题哦,能给个临时的解决方案吗? @Junior2Ran

chenshuox commented 3 years ago

image

依然有问题哦,能给个临时的解决方案吗? @Junior2Ran

临时解决方案就是换高德 [😏]