mirror of
https://gitlab.com/little-lines/frontend.git
synced 2024-11-24 13:26:52 +00:00
show each data for favorites page
This commit is contained in:
parent
ff5333c715
commit
19ba190ced
2 changed files with 57 additions and 62 deletions
|
@ -37,7 +37,7 @@
|
||||||
<v-list-item-title class="text-decoration-underline">{{nearestStructureData.lon}} , {{nearestStructureData.lat}}</v-list-item-title>
|
<v-list-item-title class="text-decoration-underline">{{nearestStructureData.lon}} , {{nearestStructureData.lat}}</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
|
||||||
<v-list-item>
|
<!-- <v-list-item>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<v-avatar>
|
<v-avatar>
|
||||||
<img :src="detial[2].icon"
|
<img :src="detial[2].icon"
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
</v-avatar>
|
</v-avatar>
|
||||||
</template>
|
</template>
|
||||||
<v-list-item-title>{{detial[2].title}}</v-list-item-title>
|
<v-list-item-title>{{detial[2].title}}</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item> -->
|
||||||
|
|
||||||
|
|
||||||
</v-list>
|
</v-list>
|
||||||
|
@ -254,7 +254,7 @@ export default {
|
||||||
if (this.isLocationRequested && !this.userLocation) {
|
if (this.isLocationRequested && !this.userLocation) {
|
||||||
return 'Requesting location...';
|
return 'Requesting location...';
|
||||||
} else if (this.userLocation) {
|
} else if (this.userLocation) {
|
||||||
return `${this.userLocation.lat.toFixed(6)}, ${this.userLocation.lon.toFixed(6)}`;
|
return `${this.userLocation.lon.toFixed(6)}, ${this.userLocation.lat.toFixed(6)}`;
|
||||||
}
|
}
|
||||||
return 'Location not available';
|
return 'Location not available';
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>My Favorites</h1>
|
<h1>Favorites</h1>
|
||||||
<ul>
|
<ul class="favorite-list">
|
||||||
<li v-for="(favorite, index) in favorites" :key="index">
|
<li v-for="(favorite, index) in favorite" :key="index" class="favorite-item">
|
||||||
<p>Favorite {{ index + 1 }}:</p>
|
{{ favorite.place_name }} <!-- แสดงข้อมูล favorites ตามความเหมาะสม -->
|
||||||
<p>Favorite ID: {{ favorite.place_name }}</p>
|
|
||||||
<p>Favorite Name: {{ favorite.place_name }}</p>
|
|
||||||
<!-- แสดงข้อมูลเพิ่มเติมหรือ field อื่นๆ ตามต้องการ -->
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const favorites = ref([]);
|
const favorite = ref([]);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -31,8 +28,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
favorites.value = data.favorites;
|
favorite.value = data;
|
||||||
console.log(data);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -40,24 +36,23 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
favorites
|
favorite
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
/* สามารถใส่ style ได้ตามต้องการ */
|
/* CSS เพื่อแสดงแต่ละข้อมูลเป็น block */
|
||||||
/* ตัวอย่าง */
|
.favorite-list {
|
||||||
ul {
|
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
.favorite-item {
|
||||||
margin-bottom: 20px;
|
display: block;
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
border: 1px solid #ccc;
|
||||||
</style>
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue