검색창 엔터
This commit is contained in:
parent
22741cb803
commit
ed02d33099
@ -4,7 +4,7 @@
|
||||
<div class="card-header">
|
||||
<!-- 검색창 -->
|
||||
<div class="container col-6 mt-12 mb-8">
|
||||
<search-bar @update:data="search" />
|
||||
<search-bar @update:data="search" @keyup.enter="searchOnEnter"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-datatable">
|
||||
@ -257,6 +257,18 @@ const fetchNoticePosts = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// Enter 키를 눌렀을 때
|
||||
const searchOnEnter = (event) => {
|
||||
const searchTextValue = event.target.value.trim();
|
||||
|
||||
if (!searchTextValue || searchTextValue[0] === ' ') {
|
||||
return; // 검색어가 비어있거나 첫 글자가 공백이면 실행 안 함
|
||||
}
|
||||
|
||||
searchText.value = searchTextValue;
|
||||
fetchGeneralPosts(1);
|
||||
};
|
||||
|
||||
// 페이지 변경
|
||||
const handlePageChange = (page) => {
|
||||
if (page !== pagination.value.currentPage) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user