ปรับ code ลงเวลาเข้า-ออกงาน (USER)

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-16 09:43:44 +07:00
parent 07b02a7818
commit 9f6fffd73c
2 changed files with 94 additions and 78 deletions

View file

@ -7,13 +7,13 @@ const center = ref<any>()
const location = ref<string>('')
const test = ref()
const emit = defineEmits(["update:location"]);
const emit = defineEmits(['update:location'])
const updateLocation = (location: any, namePOI: string) => {
// event parent component props
emit("update:location", location, namePOI);
};
emit('update:location', location, namePOI)
}
//
/** function หาตำแหน่ง*/
function findNearestPlace() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
@ -37,7 +37,10 @@ function findNearestPlace() {
}
}
/**
* function หาสถานทใกล
* @param userLocation ดละต ดลองจ
*/
function findNearestPlaceFromAPI(userLocation: any) {
const placesService = new google.maps.places.PlacesService(
document.createElement('div')
@ -55,8 +58,7 @@ function findNearestPlaceFromAPI(userLocation: any) {
const place = results[0]
location.value = place.name
test.value = place.geometry.location
updateLocation(center.value,location.value)
updateLocation(center.value, location.value)
} else {
console.error('Error fetching nearby places:', status)
}