6825-fix_vnSelectCache_and_autoload #557

Merged
alexm merged 2 commits from 6825-fix_vnSelectCache_and_autoload into test 2024-07-19 06:01:57 +00:00
1 changed files with 7 additions and 2 deletions
Showing only changes of commit 5833b4d856 - Show all commits

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, computed, watch } from 'vue'; import { ref, onBeforeMount, onMounted, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -96,6 +96,7 @@ const DEFAULT_MODE = 'card';
const TABLE_MODE = 'table'; const TABLE_MODE = 'table';
const mode = ref(DEFAULT_MODE); const mode = ref(DEFAULT_MODE);
const selected = ref([]); const selected = ref([]);
const hasParams = ref(false);
alexm marked this conversation as resolved
Review

entiendo que no has puesto $attrs['auto-load'] para evitar traerte useAttrs

entiendo que no has puesto $attrs['auto-load'] para evitar traerte useAttrs
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}'); const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
const params = ref({ ...routeQuery, ...routeQuery.filter?.where }); const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
const orders = ref(parseOrder(routeQuery.filter?.order)); const orders = ref(parseOrder(routeQuery.filter?.order));
@ -117,11 +118,14 @@ const tableModes = [
disable: $props.disableOption?.card, disable: $props.disableOption?.card,
}, },
]; ];
onBeforeMount(() => {
setUserParams(route.query[$props.searchUrl]);
hasParams.value = Object.keys(params.value).length !== 0;
});
onMounted(() => { onMounted(() => {
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode; mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode;
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
setUserParams(route.query[$props.searchUrl]);
columnsVisibilitySkiped.value = [ columnsVisibilitySkiped.value = [
...splittedColumns.value.columns ...splittedColumns.value.columns
.filter((c) => c.visible == false) .filter((c) => c.visible == false)
@ -295,6 +299,7 @@ defineExpose({
:disable-infinite-scroll="isTableMode" :disable-infinite-scroll="isTableMode"
@save-changes="reload" @save-changes="reload"
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable" :has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']"
> >
<template <template
v-for="(_, slotName) in $slots" v-for="(_, slotName) in $slots"