Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <template>
  2. <Page class="page">
  3. <ActionBar class="action-bar">
  4. <Label class="action-bar-title" text="Geolocation Demo"></Label>
  5. </ActionBar>
  6.  
  7. <StackLayout>
  8. <Label v-if="needLocation" text="Looking up your location..." />
  9. <Label v-if="locationFailure" text="Sorry, I failed! :(" />
  10. <Label v-if="location" :text="locationDescription" textWrap="true" />
  11. </StackLayout>
  12.  
  13. </Page>
  14. </template>
  15.  
  16. <script>
  17. import * as Geolocation from 'nativescript-geolocation';
  18. import LocationService from '../api/LocationService';
  19.  
  20. export default {
  21. data() {
  22. return {
  23. needLocation:true,
  24. locationFailure:false,
  25. location:null
  26. }
  27. },
  28. computed: {
  29. locationDescription() {
  30. return `You are at ${this.location.latitude}, ${this.location.longitude}. Your altitude is ${this.location.altitude}.`;
  31. }
  32. },
  33. async created() {
  34. console.log('lets try to get location!!');
  35.  
  36. let locs = await LocationService.getLocations();
  37. console.log('got locs maybe', loc);
  38.  
  39. }
  40. };
  41. </script>
  42.  
  43. <style scoped lang="scss">
  44. // Start custom common variables
  45. @import '../app-variables';
  46. // End custom common variables
  47. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement