Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaoka committed Oct 2, 2024
1 parent f72fe8b commit 6ed86cf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/menu/keyword/KeywordListPopoverItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ defineProps<{
const searchStore = useSearchStore();
function setSearchTerm(term: string) {
function setSearchString(str: string) {
// 空白を含むならダブルクォーテーションで囲む
const formattedTerm = term.includes(" ") ? `"${term}"` : term;
const formattedStr = str.includes(" ") ? `"${str}"` : str;
// 同じものなら検索を解除
if (searchStore.searchString === formattedTerm) {
if (searchStore.searchString === formattedStr) {
searchStore.setSearchString("");
return;
}
searchStore.setSearchString(formattedTerm);
searchStore.setSearchString(formattedStr);
}
</script>

Expand All @@ -26,7 +26,7 @@ function setSearchTerm(term: string) {
v-for="item in itemList"
:key="item.value"
class="py-1 hover:bg-gray-100"
@click="setSearchTerm(item.value)"
@click="setSearchString(item.value)"
>
<div class="flex items-center gap-2 px-3 text-start">
<p class="line-clamp-2 flex-1 [overflow-wrap:anywhere]">
Expand Down

0 comments on commit 6ed86cf

Please sign in to comment.