如何在 Mapbox GL JS 中更改光标图像

vir*_*nde 0 mapbox-gl-js

如何更改 Mapbox GL JS 中的光标图像?我努力了

#map-container {
    cursor: crosshair;
    }
but it doesn't work.
Run Code Online (Sandbox Code Playgroud)

vir*_*nde 6

#map-container canvas {
    cursor: crosshair;
    }
where #map-container is the id of the element where your mapbox Gl JS is located.
Run Code Online (Sandbox Code Playgroud)

或以编程方式

map.getCanvas().style.cursor = 'crosshair'
Run Code Online (Sandbox Code Playgroud)