HEREMaps react无法读取未定义的属性

时间:2018-08-27 13:03:08

标签: javascript reactjs maps typeerror

当前尝试使用var locations = {} var Data = [ { location: "01" , city: "01"}, { location: "01" , city: "02"}, { location: "03" , city: "03"}, { location: "04" , city: "04"}, { location: "01" , city: "01"}, { location: "01" , city: "01"} ] Data.forEach(val=>{ var key = val.location+"_"+val.city; locations[key] = val; }); locations = Object.values(locations); console.log(locations);,但我没有运气。

react-here-maps

在我的应用中使用此组件时,会显示错误

import React, { Component } from 'react';
import HEREMap from 'react-here-maps';
import PropTypes from 'prop-types';

export default class Map extends Component {
    render() {
        return (
            <HEREMap
                appId="KEY"
                appCode="KEY"
                center={{ lat: 0, lng: 0 }}
                zoom={14}
            />
        )
    }
}

第一个详细的错误行是

TypeError: Cannot read property 'object' of undefined

我认为它与原型有关,但是我已经安装了原型。有人知道如何解决这个问题吗?

0 个答案:

没有答案