如何隐藏 Mapbox gl 方向中的转向指令?

How to hide turn instructions in Mapbox gl directions?

我在 Ionic - v4 中使用 Mapbox gl,如 Mapbox 文档中所示,我添加了 Display driving directions。使用方向控制它显示转弯指令,我想要隐藏转弯指令。

mapboxgl.accessToken = environment.mapbox.accessToken;
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v11',
center: [-79.4512, 43.6568],
zoom: 13
});

map.addControl(new MapboxDirections({
accessToken: mapboxgl.accessToken
}), 'top-left');

reference 说:

options.controls.instructions Boolean Hide or display the instructions control. (optional, default true)

所以代码是这样的

map.addControl(new MapboxDirections({
    accessToken: mapboxgl.accessToken,
    controls: {instructions: false}
}), 'top-left');

应该可以。