I am doing a small application with Vue.js, to return the distance between 2 cities, however I cannot get the returned value from my javascript function. My code is pretty basic:-
<template>
<div>
  <label>Your distance is {{getDistance()}}</label>
</div>
  <script>
    export default {
    name: 'google-map-distance',
    data: function () {
    return {
    }
  },
  methods: {
    getDistance: function () {
      var distance = 0.00;
      var directionsService = new google.maps.DirectionsService();
      var request = {
        origin      : 'London', // a city, full address, landmark etc
        destination : 'Manchester',
        travelMode  : google.maps.DirectionsTravelMode.DRIVING
      };
      directionsService.route(request, function(response, status) {
        if ( status == google.maps.DirectionsStatus.OK ) {
          distance = ((response.routes[0].legs[0].distance.value) / 1000).toFixed(2); 
          console.log(distance);
          return(distance );
        }
        else {
          return( distance ); 
        }
      });
    }
  }
}
</script>
How can I return the distance properly so that I can display it in my label?
Thanks for your help and time.
 
    