fix search (partially)
This commit is contained in:
parent
c31e93eefd
commit
6669f44642
1 changed files with 8 additions and 9 deletions
|
@ -6,19 +6,19 @@ import { computed, onMounted, onUpdated } from 'vue';
|
||||||
const filteredData = computed(() => {
|
const filteredData = computed(() => {
|
||||||
const searchValue: string = state.search.value;
|
const searchValue: string = state.search.value;
|
||||||
let filteredTopics = state.topics
|
let filteredTopics = state.topics
|
||||||
let testi = null
|
|
||||||
|
|
||||||
if (searchValue !== '') {
|
if (searchValue !== '') {
|
||||||
filteredTopics = state.topics?.filter((topic: Topic) => {
|
filteredTopics = state.topics?.filter((topic: Topic) => {
|
||||||
return topic.papers?.filter((paper) => {
|
let includes = false
|
||||||
paper.name.toLowerCase().includes(searchValue.toLowerCase())
|
topic.papers?.filter((paper) => {
|
||||||
// || paper.content.toLowerCase().includes(searchValue.toLowerCase())
|
if (paper.name.toLowerCase().includes(searchValue.toLowerCase())
|
||||||
// || paper.reference.toLowerCase().includes(searchValue.toLowerCase())
|
|| paper.content.toLowerCase().includes(searchValue.toLowerCase())
|
||||||
testi = paper.name.toLowerCase().includes(searchValue.toLowerCase())
|
|| paper.reference.toLowerCase().includes(searchValue.toLowerCase())
|
||||||
|
) { includes = true}
|
||||||
})
|
})
|
||||||
|
return includes
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(testi)
|
|
||||||
/* if (this.filter?.type !== '') {
|
/* if (this.filter?.type !== '') {
|
||||||
filteredTopics = filteredTopics.filter((topic: any) => {
|
filteredTopics = filteredTopics.filter((topic: any) => {
|
||||||
return topic.reference.includes(this.filter?.type.key) && topic.paper_type.includes(this.filter?.type.value)
|
return topic.reference.includes(this.filter?.type.key) && topic.paper_type.includes(this.filter?.type.value)
|
||||||
|
@ -49,7 +49,6 @@ onUpdated(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{ filteredData }}
|
|
||||||
<ul
|
<ul
|
||||||
v-if="filteredDataLength > 0"
|
v-if="filteredDataLength > 0"
|
||||||
class="w-full grid grid-flow-row gap-2 my-2"
|
class="w-full grid grid-flow-row gap-2 my-2"
|
||||||
|
|
Loading…
Reference in a new issue