forked from verdnatura/salix-front
refs #6394 fix: some navigation bugs
This commit is contained in:
parent
6b363610d2
commit
5093d0b1a6
|
@ -63,6 +63,19 @@ onMounted(() => {
|
|||
emit('init', { params: userParams.value });
|
||||
});
|
||||
|
||||
watch(
|
||||
() => route.query.params,
|
||||
(val) => {
|
||||
if (!val) {
|
||||
userParams.value = {};
|
||||
} else {
|
||||
const parsedParams = JSON.parse(val);
|
||||
userParams.value = { ...parsedParams };
|
||||
search();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const isLoading = ref(false);
|
||||
async function search() {
|
||||
isLoading.value = true;
|
||||
|
@ -70,9 +83,9 @@ async function search() {
|
|||
store.userParamsChanged = true;
|
||||
store.filter.skip = 0;
|
||||
store.skip = 0;
|
||||
store.userParams = params;
|
||||
const { params: newParams } = await arrayData.addFilter({ params });
|
||||
userParams.value = newParams;
|
||||
|
||||
if (!props.showAll && !Object.values(params).length) store.data = [];
|
||||
|
||||
isLoading.value = false;
|
||||
|
|
|
@ -27,6 +27,8 @@ export function useArrayData(key, userOptions) {
|
|||
const query = route.query;
|
||||
if (query.params) {
|
||||
store.userParams = JSON.parse(query.params);
|
||||
store.skip = 0;
|
||||
store.filter.skip = 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue