mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Delete query params if empty
This commit is contained in:
parent
b68cdf70d6
commit
2e18a19a9e
1 changed files with 23 additions and 10 deletions
|
@ -198,11 +198,15 @@ export default {
|
||||||
return this.$route.query.searchText || "";
|
return this.$route.query.searchText || "";
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$router.replace({
|
const newQuery = {
|
||||||
query: {
|
|
||||||
...this.$route.query,
|
...this.$route.query,
|
||||||
searchText: value,
|
searchText: value,
|
||||||
|
};
|
||||||
|
if (!value) {
|
||||||
|
delete newQuery.searchText;
|
||||||
}
|
}
|
||||||
|
this.$router.replace({
|
||||||
|
query: newQuery,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -286,13 +290,22 @@ export default {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
updateFilter(newFilter) {
|
updateFilter(newFilter) {
|
||||||
this.$router.replace({
|
let newQuery = {
|
||||||
query: {
|
|
||||||
...this.$route.query,
|
...this.$route.query,
|
||||||
status: newFilter.status,
|
...newFilter,
|
||||||
active: newFilter.active,
|
};
|
||||||
tags: newFilter.tags,
|
if (!newFilter.status || newFilter.status.length === 0) {
|
||||||
},
|
delete newQuery.status;
|
||||||
|
}
|
||||||
|
if (!newFilter.active || newFilter.active.length === 0) {
|
||||||
|
delete newQuery.active;
|
||||||
|
}
|
||||||
|
if (!newFilter.tags || newFilter.tags.length === 0) {
|
||||||
|
delete newQuery.tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$router.replace({
|
||||||
|
query: newQuery,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue