Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Apr 17, 2024
1 parent 40426de commit 4740d60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/components/search/SearchResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@
import EditDocument from './EditDocument.vue'
import { useSearchResult } from '../../composables/components/search/SearchResult.ts'
import type { SearchResultProps } from '../../composables/components/search/SearchResult.ts'
import { ref } from 'vue'
const props = defineProps<SearchResultProps>()
const emit = defineEmits<{ reload: [] }>()
const buttonsVisible = ref(false)
const onIntersection = (entry: IntersectionObserverEntry) => {
if (entry.isIntersecting) console.log("yes")
buttonsVisible.value = entry.isIntersecting
return true
}
const {
resultColumns,
edit,
showDocument,
deleteDocument,
renderValue
renderValue,
buttonsVisible,
onIntersection
} = useSearchResult(props, emit)
</script>
10 changes: 9 additions & 1 deletion src/composables/components/search/SearchResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ export const useSearchResult = (props: SearchResultProps, emit: any) => {
}
}

const buttonsVisible = ref(false)
const onIntersection = (entry: IntersectionObserverEntry) => {
buttonsVisible.value = entry.isIntersecting
return true
}

return {
resultColumns,
edit,
showDocument,
deleteDocument,
renderValue
renderValue,
buttonsVisible,
onIntersection
}
}

0 comments on commit 4740d60

Please sign in to comment.