forked from verdnatura/salix-front
feat: solve ItemFixedFilterPanel
This commit is contained in:
parent
ff80a768d7
commit
3a7050d6c4
|
@ -110,6 +110,7 @@ async function search(evt) {
|
|||
|
||||
store.filter.where = {};
|
||||
isLoading.value = true;
|
||||
if (evt?.param) Object.assign(userParams.value, evt.param);
|
||||
const filter = { ...userParams.value };
|
||||
store.userParamsChanged = true;
|
||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
||||
|
|
|
@ -24,12 +24,16 @@ const route = useRoute();
|
|||
|
||||
const itemTypeWorkersOptions = ref([]);
|
||||
const sanitizeParam = (param) => {
|
||||
return JSON.parse(route.query.params)[param] ? 'true' : 'false';
|
||||
const params = JSON.parse(route.query.params);
|
||||
return params[param] ?? 'false';
|
||||
};
|
||||
const $params = ref({});
|
||||
onMounted(() => {
|
||||
['mine', 'hasMinPrice'].forEach((tag) => ($params.value[tag] = sanitizeParam(tag)));
|
||||
});
|
||||
const pushParam = (param) => ({
|
||||
param: { [param]: $params.value[param] },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -42,6 +46,7 @@ onMounted(() => {
|
|||
/>
|
||||
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
|
||||
<template #body="{ params, searchFn }">
|
||||
{{ $params }}
|
||||
{{ JSON.parse(route.query.params).mine }}
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
|
@ -102,8 +107,7 @@ onMounted(() => {
|
|||
v-model="$params.mine"
|
||||
:true-value="'true'"
|
||||
:false-value="'false'"
|
||||
toggle-indeterminate="true"
|
||||
@update:model-value="searchFn()"
|
||||
@update:model-value="searchFn(pushParam('mine'))"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
|
@ -112,8 +116,7 @@ onMounted(() => {
|
|||
v-model="$params.hasMinPrice"
|
||||
:true-value="'true'"
|
||||
:false-value="'false'"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
@update:model-value="searchFn(pushParam('hasMinPrice'))"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
Loading…
Reference in New Issue