perf: comments

This commit is contained in:
Javier Segarra 2025-02-17 19:33:29 +01:00
parent c212b8e21c
commit c0823b0f48
2 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, provide, inject, onMounted } from 'vue';
import { ref, computed, inject, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData';
import toDate from 'filters/toDate';
@ -89,28 +89,30 @@ const store = arrayData.store;
const userParams = ref(useFilterParams($props.dataKey).params);
const userOrders = ref(useFilterParams($props.dataKey).orders);
const searchbar = ref(null);
defineExpose({ search, params: userParams, remove });
const isLoading = ref(false);
onMounted(() => {
searchbar.value = inject('searchbar');
});
const isLoading = ref(false);
defineExpose({ search, params: userParams, remove });
async function search(evt) {
try {
if ($props.useSearchbar) {
if (!searchbar.value) {
console.error('Searchbar not found');
return;
}
if (typeof $props.useSearchbar === 'function') {
$props.useSearchbar(userParams.value);
if (Object.keys(userParams.value).length == 0) {
if (!Object.keys(userParams.value).length) {
searchbar.value();
return;
}
}
}
if (evt && $props.disableSubmitEvent) debugger;
if (evt && $props.disableSubmitEvent) return;
store.filter.where = {};
isLoading.value = true;

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, ref } from 'vue';
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
@ -8,7 +8,6 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import { Notify } from 'quasar';
import useNotify from 'src/composables/useNotify';
const { t } = useI18n();