From e51b90f554458a96d083f9b3ff6c2a03dd04a58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=A2=85=EB=AF=BC?= Date: Sun, 28 Jan 2024 13:47:08 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20=EB=B9=88=20=EB=AC=B8=EC=9E=90=EC=97=B4?= =?UTF-8?q?=20=EA=B2=80=EC=83=89=20=EB=B6=88=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HeaderComponent.vue | 4 ++-- src/views/ProductListView.vue | 37 ++++++++++++++---------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/components/HeaderComponent.vue b/src/components/HeaderComponent.vue index c37c34b..a353af8 100644 --- a/src/components/HeaderComponent.vue +++ b/src/components/HeaderComponent.vue @@ -42,7 +42,7 @@ const memberId = computed(() => memberInfo.value.memberId) const searchQuery = ref(null) const routeSearch = () => { - if (searchQuery.value === null) { + if (searchQuery.value === null || searchQuery.value.trim().length === 0) { infoModal('알림', '검색 키워드를 입력해주세요.') } else { window.location.href = `/product-search?query=${searchQuery.value}` @@ -274,4 +274,4 @@ onMounted(async () => { + \ No newline at end of file diff --git a/src/views/ProductListView.vue b/src/views/ProductListView.vue index d31ea82..dedebab 100644 --- a/src/views/ProductListView.vue +++ b/src/views/ProductListView.vue @@ -55,11 +55,6 @@ const initData = async () => { onBeforeMount(initData) -const scrollToTop = () => { - alert('to top') - window.scrollTo({ top: 0, behavior: 'smooth' }) -} - const changeBrand = (idx: number) => { // 한 번 누른거 또 누르면 브랜드 선택 해제 if (brandId.value === brandStore.brandList[idx].id) { @@ -84,21 +79,23 @@ const changeGender = (genderVal: string) => { // 검색 버튼 클릭 시 다시 조회 const changeQuery = async () => { - const response: ReadProductSliceResponse = await getProductSlice( - brandId.value, - categoryId.value, - gender.value, - lowPrice.value, - highPrice.value, - query.value, - (page.value = 0), - sort.value, - direction.value - ) + if (query.value !== null && query.value.trim().length !== 0) { + const response: ReadProductSliceResponse = await getProductSlice( + brandId.value, + categoryId.value, + gender.value, + lowPrice.value, + highPrice.value, + query.value, + (page.value = 0), + sort.value, + direction.value + ) - page.value++ - hasNext.value = response.hasNext - products.value = response.productResponses + page.value++ + hasNext.value = response.hasNext + products.value = response.productResponses + } } // 정렬 기준 변경 시 다시 조회 @@ -639,4 +636,4 @@ const getProductMaxDiscountPercentage = (product: ReadProductResponse) => { width: 10vw; height: 19.5vh; } - + \ No newline at end of file