Google Maps and Geolocation app using Vue 3 Composition API

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024

ความคิดเห็น • 27

  • @imakeinternetdev
    @imakeinternetdev 3 หลายเดือนก่อน

    This is the most informative tutorial I have found for integrating Google Maps Javascript API. I really appreciate going the native API route vs. using a third-party library that will likely go unmaintained.

  • @xxManscapexx
    @xxManscapexx 2 ปีที่แล้ว

    This helped me out a lot, thanks Justin.

  • @tr5946
    @tr5946 3 ปีที่แล้ว +1

    Very clean. Very impressive.

  • @JORGEMARTINEZ-ho4wp
    @JORGEMARTINEZ-ho4wp 3 ปีที่แล้ว +1

    Loving the Vue 3 content! :)

  • @maskman4821
    @maskman4821 3 ปีที่แล้ว

    I love this tutorial, it makes life very easy and make people not intimidated the configuration !!!

  • @AARP41298
    @AARP41298 3 ปีที่แล้ว

    Thank you, i was getting crazy about how to use this api in the new vue, and the code for geolocation, was amazing, i hope vue3 google map grow up enought to use info windows, and have a cleanest code in my project

  • @rangabharath4253
    @rangabharath4253 3 ปีที่แล้ว +1

    Awesome 👍

  • @lucasmota8345
    @lucasmota8345 ปีที่แล้ว

    Muito bom, ajudou de mais. very good!

  • @PhoudthaxaySisomboun
    @PhoudthaxaySisomboun 2 ปีที่แล้ว

    Very good Thank you

  • @traphouse3436
    @traphouse3436 3 ปีที่แล้ว +1

    huge tnx :)

  • @hackwithharsha5228
    @hackwithharsha5228 3 ปีที่แล้ว +3

    Thanks Justin.. One Question
    00:02:16 why ref instead of reactive ? , Initially, I thought ref is for primitive data-types and reactive is for object kind of data-structures..
    But, I was wrong, ref calls reactive inside.. so we can use object like data-structures inside ref too.
    Then, why we need reactive ? I understand, still in bits and pieces.. Please clarify..

    • @CodingWithJustin
      @CodingWithJustin  3 ปีที่แล้ว +3

      Good question!
      At 2:40 you can see we are doing an assignment to the ref. If this was using reactive() that assignment would break reactivity. Playing around with this code sandbox might clear it up codesandbox.io/s/elastic-platform-7v0fd?file=/src/App.vue
      When using reactive you can assign values to a key of the object, not the objects itself. This is because Vue needs to keep the same object pointer to track changes.
      You could build an application without reactive. But why? accessing values on a reactive object is cleaner than typing .value everywhere. My thought process is to use reactive when possible. Readability is very important in large scale software projects

    • @hackwithharsha5228
      @hackwithharsha5228 3 ปีที่แล้ว

      @@CodingWithJustin Thanks for clarification in very simple words..

  • @voiceoverhowdidyoudoit4692
    @voiceoverhowdidyoudoit4692 ปีที่แล้ว

    Can you please do a current tutorial for using the Javascript Maps points API? The only ones I can find are in Laravelle or don't work

  • @peteroliver7405
    @peteroliver7405 3 ปีที่แล้ว +3

    I had problems with the time it was taking the api to return my location in App.vue setup onMount. It was centering the map at 0/0. Below is my solution:
    Created a Sleep function:
    function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
    }
    Awaited lat/lng to be non-zero:
    onMounted(async () => {
    await loader.load()
    console.log("centering map on coords")
    while (currPos.value.lat == 0 && currPos.value.lng == 0 ) {
    console.log("Awaiting Coords")
    await sleep(500)
    }
    console.log("Centering Lat: " + currPos.value.lat)
    console.log("Centering Lng: " + currPos.value.lng)
    map.value = new google.maps.Map(mapDiv.value, {
    center: currPos.value,
    zoom: 20
    })
    clickListener = map.value.addListener(
    'click',
    ({latLng: {lat, lng}}) =>
    (otherPos.value = {lat: lat(), lng: lng()})
    )
    })

    • @jimmysaul6660
      @jimmysaul6660 2 ปีที่แล้ว +3

      I faced the same problem but solved it by using a watcher to call setCenter on the map when currPos is updated:
      import { watch } from 'vue'
      watch(currPos, (currPos) => {
      if (map.value) {
      map.value.setCenter(currPos);
      }
      });

  • @RianY2K
    @RianY2K 3 ปีที่แล้ว

    thank you, hope you can make video about Vue and Nuxt too

  • @bogosortfan6275
    @bogosortfan6275 ปีที่แล้ว

    is it possible to access the coordinates by adding the event listener directly into the div? Like @click="function"

  • @zergzerg4844
    @zergzerg4844 11 หลายเดือนก่อน +1

    Using mounted and unmounted hooks outside the script setup is bad approach. If you are using nuxt 3 you'll see the warning that you have to use this hook only for script setup

  • @JesGeeMusic
    @JesGeeMusic ปีที่แล้ว

    .load is deprecated and has me completely stuck at 5:20

  • @adiprimanto8871
    @adiprimanto8871 ปีที่แล้ว

    is vue3-google-map useable for nuxt 3?

  • @AmeliorScout
    @AmeliorScout 2 ปีที่แล้ว

    I'm having issues with the map not appearing on screen. I was able to get the Your Position div to load before, but now neither that nor the Map div is loading. The only errors I'm really seeing are that onMounted, google, and mapDiv isn't defined if I remove the eslint-disable comment. just to see what other errors thee could be.
    I'm not using TypeScript and that might be the problem. If so, any way to do this without TypeScript?

    • @jamesdykes4141
      @jamesdykes4141 ปีที่แล้ว

      I had the same issue. Easy fix is to add lang="ts" to your script tag in teh App.vue file

  • @rojasguarachinestorignacio884
    @rojasguarachinestorignacio884 10 หลายเดือนก่อน

    no sirve en Vue3 F