Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component registration via CDN #201

Open
th-ink opened this issue Aug 24, 2020 · 0 comments
Open

Component registration via CDN #201

th-ink opened this issue Aug 24, 2020 · 0 comments

Comments

@th-ink
Copy link

th-ink commented Aug 24, 2020

Hello, I am including vue-mapbox via cdn like so:

<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.js"></script>
     <!-- Vue-mapbox -->
   <script
     type="text/javascript"
     src="https://cdn.jsdelivr.net/npm/vue-mapbox@latest/dist/vue-mapbox.min.js"
   ></script>

and then in the JS section, am registering component like so:

  const appMap = new Vue({
    el: '.culturemap__page',
    components: {
      'mgl-map': window.VueMapbox.MglMap,
    },
    data: {
      accessToken: "*****", // your access token. Needed if you using Mapbox maps
      mapStyle: 'mapbox://styles/mapbox/streets-v11'
    },
     created(){
       console.log(this)
       this.mapbox = window.mapboxgl;
    },
  })

and in the html:

<mgl-map :map-style="mapStyle"  :access-token="accessToken" />

however when opening in browser I get the following error:

Uncaught (in promise) TypeError: Cannot set property 'accessToken' of undefined

Would anyone be able to help?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant