Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 3x 3x 3x 3x 3x 1x | <template> <div class="conatiner"> <div class="list" v-for="location in locations" :key="location"> <SingleList :title="location.locationName" @click="openCard(location)" /> </div> </div> </template> <script> import LocationService from "../LocationService"; import SingleList from "../components/SingleList.vue"; import router from "@/router"; import { onActivated } from "@vue/runtime-core"; export default { components: { SingleList }, name: "AllLocations", data() { return { locations: [], }; }, /** * @vuese * Gets all the locations from the Get Locations API and updates the location list on every page reload. */ async mounted() { let titles = null; try { titles = await LocationService.getLocations(); titles = titles.data; console.log(titles); } catch (err) { console.log(err); } for (let i = 0; i < titles.length; i++) { this.locations.push(titles[i]); console.log(this.locations); } }, async onActivated() { this.mounted(); }, methods: { /** * @vuese * Redirects the user to a details view of the user selected location from the list. */ async openCard(location) { sessionStorage.setItem("currentLocation", JSON.stringify(location)); await router.push("/"); }, }, }; </script> <style scoped> .list { margin: 1.5rem; cursor: default; } </style> |