diff --git a/src/components/common/VnSection.vue b/src/components/common/VnSection.vue index ef65b841f..03871c3b1 100644 --- a/src/components/common/VnSection.vue +++ b/src/components/common/VnSection.vue @@ -2,7 +2,7 @@ import RightAdvancedMenu from './RightAdvancedMenu.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnTableFilter from '../VnTable/VnTableFilter.vue'; -import { onBeforeMount, onMounted, onUnmounted, computed, ref } from 'vue'; +import { onBeforeMount, onMounted, onUnmounted, computed, ref, provide } from 'vue'; import { useArrayData } from 'src/composables/useArrayData'; import { useRoute, useRouter } from 'vue-router'; import { useHasContent } from 'src/composables/useHasContent'; @@ -52,10 +52,12 @@ const router = useRouter(); let arrayData; const sectionValue = computed(() => $props.section ?? $props.dataKey); const isMainSection = ref(false); +const searchbarRef = ref(null); const searchbarId = 'section-searchbar'; const advancedMenuSlot = 'advanced-menu'; const hasContent = useHasContent(`#${searchbarId}`); +provide('searchbar', () => searchbarRef.value?.search()); onBeforeMount(() => { if ($props.dataKey) @@ -90,6 +92,7 @@ function checkIsMain() {