Let’s say that you have a webform where you are collecting a user’s street address. You can save the user a few minutes by defaulting the value for them. In this example, we are using Vue.js, Axios, a MapQuest API, and navigator.geolocation to first get the latitude and longitude from the client and then send it off to MapQuest to get a physical address.
This example builds off of our earlier Axios / Vue.js 2 APIs 101 post. But you will notice that there is a methods property, now. The this.geolocation() function is then kicked off within mounted().
Have a question or comment? Drop it in the comments and I will try to help.
Top comments (0)