单张反应标记的图标选项将其设置为某个值时引发错误

时间:2019-12-03 12:17:46

标签: markers react-leaflet

当我在React传单中设置标记的图标选项时,它抛出TypeError:

  

无法读取NewClass._initIcon上未定义的属性'createIcon'。

var newIcon =  L.icon({
     iconUrl: require('leaflet/dist/images/marker-icon.png'),
     shadowUrl: require('leaflet/dist/images/marker-shadow.png')
});

 <Marker
    draggable={false}
    position={coordinates}
    ref={null}
    icon={newIcon}
 >
    <Popup minWidth={90}>
       <span>
        {'title'}
       </span>{' '}
       <br />
       <span>{'some comment'}</span>
    </Popup>
 </Marker>

0 个答案:

没有答案