我正在尝试使用一个超文本标记语言<input type="color">元素来动态更改地图中GeoJSON层的颜色。我的代码可以工作,但layer Fill对象的颜色参数仅在我移动地图或放大/缩小时刷新。有没有办法在运行中做到这一点?我使用setColor()函数来编辑颜色属性的值。 //Change Vector Layer Color function hexToRgb(hex) {
我不能使用e.target和e.layer以及GeoJSON resetStyle方法来实现这一点,正如这里的许多其他线程所建议的那样。'Uncaught TypeError: Cannot read property 'setStyle' of undefined' at e.<anonymous> ((index):178) at e._fireDOMEvent