-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Highlight matching text and show matching ID when relevant
The ID is only shown when there is a match with the ID, but not with the name.
- Loading branch information
1 parent
8140aca
commit 684404b
Showing
2 changed files
with
36 additions
and
2 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
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,19 @@ | ||
<template> | ||
<span>{{ match.before }}</span> | ||
<span class="font-weight-bold">{{ match.match }}</span> | ||
<span>{{ match.after }}</span> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import { findMatchingParts } from '@/lib/search' | ||
interface Props { | ||
value: string | ||
query?: string | ||
} | ||
const props = defineProps<Props>() | ||
const match = computed(() => findMatchingParts(props.value, props.query ?? '')) | ||
</script> |