0
0
Fork 0

feat: try to fix ItemFixedFilterPanel

This commit is contained in:
Javier Segarra 2024-07-04 18:23:45 +02:00
parent 5d6cdd4e2e
commit ff80a768d7
1 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref } from 'vue';
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
@ -19,8 +19,17 @@ defineProps({
default: () => [],
},
});
import { useRoute } from 'vue-router';
const route = useRoute();
const itemTypeWorkersOptions = ref([]);
const sanitizeParam = (param) => {
return JSON.parse(route.query.params)[param] ? 'true' : 'false';
};
const $params = ref({});
onMounted(() => {
['mine', 'hasMinPrice'].forEach((tag) => ($params.value[tag] = sanitizeParam(tag)));
});
</script>
<template>
@ -33,6 +42,7 @@ const itemTypeWorkersOptions = ref([]);
/>
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
<template #body="{ params, searchFn }">
{{ JSON.parse(route.query.params).mine }}
<QItem class="q-my-md">
<QItemSection>
<VnSelect
@ -89,15 +99,19 @@ const itemTypeWorkersOptions = ref([]);
<QItemSection>
<QCheckbox
:label="t('components.itemsFilterPanel.mine')"
v-model="params.mine"
toggle-indeterminate
v-model="$params.mine"
:true-value="'true'"
:false-value="'false'"
toggle-indeterminate="true"
@update:model-value="searchFn()"
/>
</QItemSection>
<QItemSection>
<QCheckbox
:label="t('components.itemsFilterPanel.hasMinPrice')"
v-model="params.hasMinPrice"
v-model="$params.hasMinPrice"
:true-value="'true'"
:false-value="'false'"
toggle-indeterminate
@update:model-value="searchFn()"
/>