forked from verdnatura/salix-front
feat: try to fix ItemFixedFilterPanel
This commit is contained in:
parent
5d6cdd4e2e
commit
ff80a768d7
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -19,8 +19,17 @@ defineProps({
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
const itemTypeWorkersOptions = ref([]);
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -33,6 +42,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
/>
|
/>
|
||||||
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
|
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params, searchFn }">
|
||||||
|
{{ JSON.parse(route.query.params).mine }}
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -89,15 +99,19 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('components.itemsFilterPanel.mine')"
|
:label="t('components.itemsFilterPanel.mine')"
|
||||||
v-model="params.mine"
|
v-model="$params.mine"
|
||||||
toggle-indeterminate
|
:true-value="'true'"
|
||||||
|
:false-value="'false'"
|
||||||
|
toggle-indeterminate="true"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('components.itemsFilterPanel.hasMinPrice')"
|
:label="t('components.itemsFilterPanel.hasMinPrice')"
|
||||||
v-model="params.hasMinPrice"
|
v-model="$params.hasMinPrice"
|
||||||
|
:true-value="'true'"
|
||||||
|
:false-value="'false'"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue