我在我的类的render方法里有一个类似下面的JSX。
<ReactMapGL
ref={this.mapRef}
{...viewport}
mapboxApiAccessToken={process.env.REACT_APP_MAPBOX_TOKEN}
onViewportChange={this.handleViewportChange}
}
}
>
似乎找不到该怎么指定才能让光标变成指针或十字线,而不是默认的手部图标。
当我在浏览器中打开它时,我看到的是一个 <div>
像下面这样的元素,它将光标设置为 "grab",我想让它最初是一个不同的值。
<div style="position: relative; width: 1618px; height: 272px; cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); outline: none;" tabindex="0">
原来我需要在我的ReactMapGL组件中添加以下内容:
getCursor={(e) => "crosshair"}