-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from full-ownership/feature/search
feat : 1249 commit...
- Loading branch information
Showing
11 changed files
with
399 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script setup> | ||
import { ref, onMounted } from "vue"; | ||
import axios from "axios"; | ||
// Props 정의 | ||
const props = defineProps({ | ||
latitude: Number, // 위도 | ||
longitude: Number, // 경도 | ||
}); | ||
const kakaoApiKey = "f33cead2772e90625f7ee617bcf79982"; // 카카오 REST API 키 | ||
const oliveYoungPlaces = ref([]); // 검색 결과 저장 | ||
// 올리브영 검색 함수 | ||
const searchOliveYoungNearby = async (latitude, longitude) => { | ||
try { | ||
console.log('latitude',latitude) | ||
const url = `https://dapi.kakao.com/v2/local/search/keyword.json`; | ||
const params = { | ||
query: "맥도날드", // 검색어 | ||
x: longitude, // 경도 | ||
y: latitude, // 위도 | ||
radius: 1000, // 반경 1km | ||
}; | ||
const headers = { | ||
Authorization: `KakaoAK ${kakaoApiKey}`, // 카카오 인증 헤더 | ||
}; | ||
const response = await axios.get(url, { headers, params }); | ||
oliveYoungPlaces.value = response.data.documents; // 검색 결과 저장 | ||
} catch (error) { | ||
console.error("카카오 API 호출 오류:", error); | ||
oliveYoungPlaces.value = []; // 오류 발생 시 초기화 | ||
} | ||
}; | ||
// Props가 변경될 때마다 검색 함수 호출 | ||
onMounted(async () => { | ||
if (props.latitude && props.longitude) { | ||
console.log("onMounted로 API 호출:", props.latitude, props.longitude); | ||
await searchOliveYoungNearby(props.latitude, props.longitude); | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span v-if="oliveYoungPlaces.length > 0" style="display: inline-block;" class="shadow-md"> | ||
<img src="@/assets/icons/mcdonald.png" width="100%"> | ||
</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script setup> | ||
import { ref, onMounted } from "vue"; | ||
import axios from "axios"; | ||
// Props 정의 | ||
const props = defineProps({ | ||
latitude: Number, // 위도 | ||
longitude: Number, // 경도 | ||
}); | ||
const kakaoApiKey = "f33cead2772e90625f7ee617bcf79982"; // 카카오 REST API 키 | ||
const oliveYoungPlaces = ref([]); // 검색 결과 저장 | ||
// 올리브영 검색 함수 | ||
const searchOliveYoungNearby = async (latitude, longitude) => { | ||
try { | ||
console.log('latitude',latitude) | ||
const url = `https://dapi.kakao.com/v2/local/search/keyword.json`; | ||
const params = { | ||
query: "올리브영", // 검색어 | ||
x: longitude, // 경도 | ||
y: latitude, // 위도 | ||
radius: 5000, // 반경 1km | ||
}; | ||
const headers = { | ||
Authorization: `KakaoAK ${kakaoApiKey}`, // 카카오 인증 헤더 | ||
}; | ||
const response = await axios.get(url, { headers, params }); | ||
oliveYoungPlaces.value = response.data.documents; // 검색 결과 저장 | ||
} catch (error) { | ||
console.error("카카오 API 호출 오류:", error); | ||
oliveYoungPlaces.value = []; // 오류 발생 시 초기화 | ||
} | ||
}; | ||
// Props가 변경될 때마다 검색 함수 호출 | ||
onMounted(async () => { | ||
if (props.latitude && props.longitude) { | ||
console.log("onMounted로 API 호출:", props.latitude, props.longitude); | ||
await searchOliveYoungNearby(props.latitude, props.longitude); | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span v-if="oliveYoungPlaces.length > 0" style="display: inline-block;" class="shadow-md"> | ||
<img src="@/assets/icons/oliveyoung.png" width="100%"> | ||
</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script setup> | ||
import { ref, onMounted } from "vue"; | ||
import axios from "axios"; | ||
// Props 정의 | ||
const props = defineProps({ | ||
latitude: Number, // 위도 | ||
longitude: Number, // 경도 | ||
}); | ||
const kakaoApiKey = "f33cead2772e90625f7ee617bcf79982"; // 카카오 REST API 키 | ||
const oliveYoungPlaces = ref([]); // 검색 결과 저장 | ||
// 올리브영 검색 함수 | ||
const searchOliveYoungNearby = async (latitude, longitude) => { | ||
try { | ||
console.log('latitude',latitude) | ||
const url = `https://dapi.kakao.com/v2/local/search/keyword.json`; | ||
const params = { | ||
query: "약국", // 검색어 | ||
x: longitude, // 경도 | ||
y: latitude, // 위도 | ||
radius: 1000, // 반경 1km | ||
}; | ||
const headers = { | ||
Authorization: `KakaoAK ${kakaoApiKey}`, // 카카오 인증 헤더 | ||
}; | ||
const response = await axios.get(url, { headers, params }); | ||
oliveYoungPlaces.value = response.data.documents; // 검색 결과 저장 | ||
} catch (error) { | ||
console.error("카카오 API 호출 오류:", error); | ||
oliveYoungPlaces.value = []; // 오류 발생 시 초기화 | ||
} | ||
}; | ||
// Props가 변경될 때마다 검색 함수 호출 | ||
onMounted(async () => { | ||
if (props.latitude && props.longitude) { | ||
console.log("onMounted로 API 호출:", props.latitude, props.longitude); | ||
await searchOliveYoungNearby(props.latitude, props.longitude); | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span v-if="oliveYoungPlaces.length > 0" style="display: inline-block;" class="shadow-md"> | ||
<img src="@/assets/icons/pharmacy.png" width="100%"> | ||
</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script setup> | ||
import { ref, onMounted } from "vue"; | ||
import axios from "axios"; | ||
// Props 정의 | ||
const props = defineProps({ | ||
latitude: Number, // 위도 | ||
longitude: Number, // 경도 | ||
}); | ||
const kakaoApiKey = "f33cead2772e90625f7ee617bcf79982"; // 카카오 REST API 키 | ||
const oliveYoungPlaces = ref([]); // 검색 결과 저장 | ||
// 올리브영 검색 함수 | ||
const searchOliveYoungNearby = async (latitude, longitude) => { | ||
try { | ||
console.log('latitude',latitude) | ||
const url = `https://dapi.kakao.com/v2/local/search/keyword.json`; | ||
const params = { | ||
query: "스타벅스", // 검색어 | ||
x: longitude, // 경도 | ||
y: latitude, // 위도 | ||
radius: 1000, // 반경 1km | ||
}; | ||
const headers = { | ||
Authorization: `KakaoAK ${kakaoApiKey}`, // 카카오 인증 헤더 | ||
}; | ||
const response = await axios.get(url, { headers, params }); | ||
oliveYoungPlaces.value = response.data.documents; // 검색 결과 저장 | ||
} catch (error) { | ||
console.error("카카오 API 호출 오류:", error); | ||
oliveYoungPlaces.value = []; // 오류 발생 시 초기화 | ||
} | ||
}; | ||
// Props가 변경될 때마다 검색 함수 호출 | ||
onMounted(async () => { | ||
if (props.latitude && props.longitude) { | ||
console.log("onMounted로 API 호출:", props.latitude, props.longitude); | ||
await searchOliveYoungNearby(props.latitude, props.longitude); | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span v-if="oliveYoungPlaces.length > 0" style="display: inline-block;" class="shadow-md"> | ||
<img src="@/assets/icons/starbucks.png" width="100%"> | ||
</span> | ||
</template> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.