fix: show clear icon only when search is input
This commit is contained in:
parent
c726b9abb4
commit
2ca3355366
2 changed files with 31 additions and 6 deletions
|
|
@ -8,8 +8,10 @@ import { useSearchDataStore } from '@/stores/searched-data'
|
|||
import { useLoader } from '@/stores/loader'
|
||||
|
||||
import AdvancedSearch from '@/modules/01_user/components/AdvancedSearch.vue'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
const loaderStore = useLoader()
|
||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||
const {
|
||||
isSearch,
|
||||
isAdvSearchCall,
|
||||
|
|
@ -37,6 +39,7 @@ const props = defineProps<{
|
|||
}>()
|
||||
|
||||
async function searchSubmit() {
|
||||
isFilePreview.value = false
|
||||
if (searchData.value.value.trim() !== '') {
|
||||
submitSearchData.value = { AND: [], OR: [] }
|
||||
if (props.mode === 'admin') {
|
||||
|
|
@ -46,6 +49,14 @@ async function searchSubmit() {
|
|||
value: searchData.value.value,
|
||||
})
|
||||
})
|
||||
submitSearchData.value.OR.push({
|
||||
field: 'fileName',
|
||||
value: searchData.value.value,
|
||||
})
|
||||
submitSearchData.value.OR.push({
|
||||
field: 'fileType',
|
||||
value: searchData.value.value,
|
||||
})
|
||||
} else {
|
||||
submitSearchData.value.OR.push({
|
||||
field: searchData.value.field,
|
||||
|
|
@ -85,6 +96,8 @@ async function searchSubmit() {
|
|||
`${import.meta.env.VITE_API_ENDPOINT}/search`,
|
||||
submitSearchData.value,
|
||||
)
|
||||
console.log(submitSearchData)
|
||||
|
||||
getFoundFile(res.data)
|
||||
isSearch.value = true
|
||||
} catch (error) {
|
||||
|
|
@ -153,6 +166,7 @@ watch(
|
|||
>
|
||||
<template v-slot:append>
|
||||
<q-icon
|
||||
v-if="searchData.value"
|
||||
name="close"
|
||||
@click="() => ((searchData.value = ''), (isSearch = false))"
|
||||
class="cursor-pointer"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue