Reputation: 302
I'm using the Mapbox JavaScript SDK in a VueJS app. I am able to display a map with no issues. Now I'd like to add some markers. I see on this page that you need to import a CSS stylesheet before markers will work. As suggested in the docs, I've tried both of the following:
import 'mapbox-gl/dist/mapbox-gl.css';
from my Vue Component<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.css">
from the <head>
of my index.html
With either of these, the map disappears, with no visible warnings or errors in the console. Without these, the map shows up fine, but I get a warning saying:
This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.
Where am I going wrong?
Upvotes: 4
Views: 1382
Reputation: 302
Turns out the map div got collapsed to 0 height when the stylesheet was imported. No idea why, but manually setting the height resolved the issue.
Upvotes: 1