This commit is contained in:
Vri 🌈 2023-06-28 21:08:37 +02:00
parent 073082b520
commit c31e93eefd
Signed by: vrifox
GPG key ID: D40098E5B60B2197
4 changed files with 14 additions and 11 deletions

View file

@ -36,5 +36,4 @@ onUpdated(() => updateSearch(searchValue, searchType))
</div>
</div>
</form>
{{ searchValue + searchType }}
</template>

View file

@ -6,13 +6,19 @@ import { computed, onMounted, onUpdated } from 'vue';
const filteredData = computed(() => {
const searchValue: string = state.search.value;
let filteredTopics = state.topics
if (state.search.value !== '') {
let testi = null
if (searchValue !== '') {
filteredTopics = state.topics?.filter((topic: Topic) => {
return topic.papers?.filter((paper) => {
paper.name.toLowerCase().includes(searchValue.toLowerCase()) /* || paper.content.toLowerCase().includes(searchValue.toLowerCase()) || paper.reference.toLowerCase().includes(searchValue.toLowerCase()) */
paper.name.toLowerCase().includes(searchValue.toLowerCase())
// || paper.content.toLowerCase().includes(searchValue.toLowerCase())
// || paper.reference.toLowerCase().includes(searchValue.toLowerCase())
testi = paper.name.toLowerCase().includes(searchValue.toLowerCase())
})
})
}
console.log(testi)
/* if (this.filter?.type !== '') {
filteredTopics = filteredTopics.filter((topic: any) => {
return topic.reference.includes(this.filter?.type.key) && topic.paper_type.includes(this.filter?.type.value)
@ -43,7 +49,7 @@ onUpdated(() => {
</script>
<template>
{{ state.search.value }}
{{ filteredData }}
<ul
v-if="filteredDataLength > 0"
class="w-full grid grid-flow-row gap-2 my-2"